(function(){function Aa(a,b,c){var d;b=b.toLowerCase();return(d=a.__allListeners||c&&(a.__allListeners={}))&&(d[b]||c&&(d[b]=[]))}function Ba(a,b,c,d,e,g){d=d&&a[b];var h;for(!d&&(d=a[c]);!d&&(h=(h||a).parentNode);){if("BODY"==h.tagName||g&&!g(h))return null;d=h[c]}return d&&e&&!e(d)?Ba(d,b,c,!1,e):d}UEDITOR_CONFIG=window.UEDITOR_CONFIG||{};var q=window.baidu||{};window.baidu=q;window.UE=q.editor={};UE.plugins={};UE.commands={};UE.instants={};UE.I18N={};UE.version="1.2.6.0";var R=UE.dom={},Bc=UE,
U=navigator.userAgent.toLowerCase(),Ca=window.opera,B={ie:!!window.ActiveXObject,opera:!!Ca&&Ca.version,webkit:-1<U.indexOf(" applewebkit/"),mac:-1<U.indexOf("macintosh"),quirks:"BackCompat"==document.compatMode};B.gecko="Gecko"==navigator.product&&!B.webkit&&!B.opera;var N=0;B.ie&&(N=parseFloat(U.match(/msie (\d+)/)[1]),B.ie9Compat=9==document.documentMode,B.ie8=!!document.documentMode,B.ie8Compat=8==document.documentMode,B.ie7Compat=7==N&&!document.documentMode||7==document.documentMode,B.ie6Compat=
7>N||B.quirks);if(B.gecko){var Z=U.match(/rv:([\d\.]+)/);Z&&(Z=Z[1].split("."),N=1E4*Z[0]+100*(Z[1]||0)+1*(Z[2]||0))}/chrome\/(\d+\.\d)/i.test(U)&&(B.chrome=+RegExp.$1);/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(U)&&!/chrome/i.test(U)&&(B.safari=+(RegExp.$1||RegExp.$2));B.opera&&(N=parseFloat(Ca.version()));B.webkit&&(N=parseFloat(U.match(/ applewebkit\/(\d+)/)[1]));B.version=N;B.isCompatible=!B.mobile&&(B.ie&&6<=N||B.gecko&&10801<=N||B.opera&&9.5<=N||B.air&&1<=N||B.webkit&&522<=N||!1);var n=
Bc.browser=B,I=n.ie,Cc=n.opera,Dc=UE,db=document.createElement("div").style,eb={"float":void 0!=db.cssFloat?"cssFloat":void 0!=db.styleFloat?"styleFloat":"float"},gb=function(a,b){try{for(var c=0,d;d=fb[c++];)if(d.doc===a&&d.url==(b.src||b.href))return d}catch(e){return null}},fb=[],$=function(a){for(a.isReady=!0;a=hb.pop();a());},hb=[],p=Dc.utils={each:function(a,b,c){if(null!=a)if(a.length===+a.length)for(var d=0,e=a.length;d<e;d++){if(!1===b.call(c,a[d],d,a))return!1}else for(d in a)if(a.hasOwnProperty(d)&&
!1===b.call(c,a[d],d,a))return!1},makeInstance:function(a){var b=new Function;b.prototype=a;a=new b;b.prototype=null;return a},extend:function(a,b,c){if(b)for(var d in b)if(!c||!a.hasOwnProperty(d))a[d]=b[d];return a},extend2:function(a){for(var b=arguments,c=1;c<b.length;c++){var d=b[c],e;for(e in d)a.hasOwnProperty(e)||(a[e]=d[e])}return a},inherits:function(a,b){var c=a.prototype,d=p.makeInstance(b.prototype);p.extend(d,c,!0);a.prototype=d;return d.constructor=a},bind:function(a,b){return function(){return a.apply(b,
arguments)}},defer:function(a,b,c){var d;return function(){c&&clearTimeout(d);d=setTimeout(a,b)}},indexOf:function(a,b,c){var d=-1;c=this.isNumber(c)?c:0;this.each(a,function(a,g){if(g>=c&&a===b)return d=g,!1});return d},removeItem:function(a,b){for(var c=0,d=a.length;c<d;c++)a[c]===b&&(a.splice(c,1),c--)},trim:function(a){return a.replace(/(^[ \t\n\r]+)|([ \t\n\r]+$)/g,"")},listToMap:function(a){if(!a)return{};a=p.isArray(a)?a:a.split(",");for(var b=0,c,d={};c=a[b++];)d[c.toUpperCase()]=d[c]=1;return d},
unhtml:function(a,b){return a?a.replace(b||/[&<">'](?:(amp|lt|quot|gt|#39|nbsp);)?/g,function(a,b){return b?a:{"<":"&lt;","&":"&amp;",'"':"&quot;",">":"&gt;","'":"&#39;"}[a]}):""},html:function(a){return a?a.replace(/&((g|l|quo)t|amp|#39);/g,function(a){return{"&lt;":"<","&amp;":"&","&quot;":'"',"&gt;":">","&#39;":"'"}[a]}):""},cssStyleToDomStyle:function(a){return eb[a]||(eb[a]=a.toLowerCase().replace(/-./g,function(a){return a.charAt(1).toUpperCase()}))},loadFile:function(a,b,c){var d=gb(a,b);if(d)d.ready?
c&&c():d.funs.push(c);else if(fb.push({doc:a,url:b.src||b.href,funs:[c]}),a.body){if(!b.id||!a.getElementById(b.id)){var e=a.createElement(b.tag);delete b.tag;for(g in b)e.setAttribute(g,b[g]);e.onload=e.onreadystatechange=function(){if(!this.readyState||/loaded|complete/.test(this.readyState)){d=gb(a,b);if(0<d.funs.length){d.ready=1;for(var c;c=d.funs.pop();)c()}e.onload=e.onreadystatechange=null}};e.onerror=function(){throw Error("The load "+(b.href||b.src)+" fails,check the url settings of file ueditor.config.js ");
};a.getElementsByTagName("head")[0].appendChild(e)}}else{c=[];for(var g in b)"tag"!=g&&c.push(g+'="'+b[g]+'"');a.write("<"+b.tag+" "+c.join(" ")+" ></"+b.tag+">")}},isEmptyObject:function(a){if(null==a)return!0;if(this.isArray(a)||this.isString(a))return 0===a.length;for(var b in a)if(a.hasOwnProperty(b))return!1;return!0},fixColor:function(a,b){if(/color/i.test(a)&&/rgba?/.test(b)){var c=b.split(",");if(3<c.length)return"";b="#";for(var d=0,e;e=c[d++];)e=parseInt(e.replace(/[^\d]/gi,""),10).toString(16),
b+=1==e.length?"0"+e:e;b=b.toUpperCase()}return b},optCss:function(a){function b(a,b){if(!a)return"";var c=a.top,d=a.bottom,f=a.left,k=a.right,m="";if(!c||!f||!d||!k)for(var p in a)m+=";"+b+"-"+p+":"+a[p]+";";else m+=";"+b+":"+(c==d&&d==f&&f==k?c:c==d&&f==k?c+" "+f:f==k?c+" "+f+" "+d:c+" "+k+" "+d+" "+f)+";";return m}var c,d;a=a.replace(/(padding|margin|border)\-([^:]+):([^;]+);?/gi,function(a,b,f,j){if(1==j.split(" ").length)switch(b){case "padding":return!c&&(c={}),c[f]=j,"";case "margin":return!d&&
(d={}),d[f]=j,"";case "border":return"initial"==j?"":a}return a});a+=b(c,"padding")+b(d,"margin");return a.replace(/^[ \n\r\t;]*|[ \n\r\t]*$/,"").replace(/;([ \n\r\t]+)|\1;/g,";").replace(/(&((l|g)t|quot|#39))?;{2,}/g,function(a,b){return b?b+";;":";"})},clone:function(a,b){var c;b=b||{};for(var d in a)a.hasOwnProperty(d)&&(c=a[d],"object"==typeof c?(b[d]=p.isArray(c)?[]:{},p.clone(a[d],b[d])):b[d]=c);return b},transUnitToPx:function(a){if(!/(pt|cm)/.test(a))return a;var b;a.replace(/([\d.]+)(\w+)/,
function(c,d,e){a=d;b=e});switch(b){case "cm":a=25*parseFloat(a);break;case "pt":a=Math.round(96*parseFloat(a)/72)}return a+(a?"px":"")},domReady:function(a,b){b=b||window;var c=b.document;a&&hb.push(a);"complete"===c.readyState?$(c):(c.isReady&&$(c),n.ie?(function(){if(!c.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}$(c)}}(),b.attachEvent("onload",function(){$(c)})):(c.addEventListener("DOMContentLoaded",function(){c.removeEventListener("DOMContentLoaded",
arguments.callee,!1);$(c)},!1),b.addEventListener("load",function(){$(c)},!1)))},cssRule:n.ie?function(a,b,c){var d;c=c||document;d=c.indexList?c.indexList:c.indexList={};var e;if(d[a])e=c.styleSheets[d[a]];else{if(void 0===b)return"";e=c.createStyleSheet("",c=c.styleSheets.length);d[a]=c}if(void 0===b)return e.cssText;e.cssText=b||""}:function(a,b,c){c=c||document;var d=c.getElementsByTagName("head")[0],e;if(!(e=c.getElementById(a))){if(void 0===b)return"";e=c.createElement("style");e.id=a;d.appendChild(e)}if(void 0===
b)return e.innerHTML;""!==b?e.innerHTML=b:d.removeChild(e)},sort:function(a,b){b=b||function(a,b){return a.localeCompare(b)};for(var c=0,d=a.length;c<d;c++)for(var e=c,g=a.length;e<g;e++)if(0<b(a[c],a[e])){var f=a[c];a[c]=a[e];a[e]=f}return a}};p.each("String Function Array Number RegExp Object".split(" "),function(a){UE.utils["is"+a]=function(b){return Object.prototype.toString.apply(b)=="[object "+a+"]"}});var Da=UE.EventBase=function(){};Da.prototype={addListener:function(a,b){a=p.trim(a).split(" ");
for(var c=0,d;d=a[c++];)Aa(this,d,!0).push(b)},removeListener:function(a,b){a=p.trim(a).split(" ");for(var c=0,d;d=a[c++];)p.removeItem(Aa(this,d)||[],b)},fireEvent:function(){for(var a=arguments[0],a=p.trim(a).split(" "),b=0,c;c=a[b++];){var d=Aa(this,c),e,g,f;if(d)for(f=d.length;f--;)if(d[f]){g=d[f].apply(this,arguments);if(!0===g)return g;void 0!==g&&(e=g)}if(g=this["on"+c.toLowerCase()])e=g.apply(this,arguments)}return e}};var Ec=R,ib,x=function(a){for(var b in a)a[b.toUpperCase()]=a[b];return a},
D=p.extend2,Ea=x({isindex:1,fieldset:1}),jb=x({input:1,button:1,select:1,textarea:1,label:1}),kb=D(x({a:1}),jb),Fa=D({iframe:1},kb),oa=x({hr:1,ul:1,menu:1,div:1,blockquote:1,noscript:1,table:1,center:1,address:1,dir:1,pre:1,h5:1,dl:1,h4:1,noframes:1,h6:1,ol:1,h1:1,h3:1,h2:1}),lb=x({ins:1,del:1,script:1,style:1}),mb=D(x({b:1,acronym:1,bdo:1,"var":1,"#":1,abbr:1,code:1,br:1,i:1,cite:1,kbd:1,u:1,strike:1,s:1,tt:1,strong:1,q:1,samp:1,em:1,dfn:1,span:1}),lb),nb=D(x({sub:1,img:1,embed:1,object:1,sup:1,
basefont:1,map:1,applet:1,font:1,big:1,small:1}),mb),pa=D(x({p:1}),nb),ob=D(x({iframe:1}),nb,jb),pb=x({img:1,embed:1,noscript:1,br:1,kbd:1,center:1,button:1,basefont:1,h5:1,h4:1,samp:1,h6:1,ol:1,h1:1,h3:1,h2:1,form:1,font:1,"#":1,select:1,menu:1,ins:1,abbr:1,label:1,code:1,table:1,script:1,cite:1,input:1,iframe:1,strong:1,textarea:1,noframes:1,big:1,small:1,span:1,hr:1,sub:1,bdo:1,"var":1,div:1,object:1,sup:1,strike:1,dir:1,map:1,dl:1,applet:1,del:1,isindex:1,fieldset:1,ul:1,b:1,acronym:1,a:1,blockquote:1,
i:1,u:1,s:1,tt:1,address:1,q:1,pre:1,p:1,em:1,dfn:1}),u=D(x({a:0}),ob),Ga=x({tr:1}),ea=x({"#":1}),qb=D(x({param:1}),pb),K=D(x({form:1}),Ea,Fa,oa,pa),qa=x({li:1,ol:1,ul:1}),Fc=x({style:1,script:1}),rb=x({base:1,link:1,meta:1,title:1}),Gc=D(rb,Fc),sb=x({head:1,body:1}),Hc=x({html:1}),tb=x({address:1,blockquote:1,center:1,dir:1,div:1,dl:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,isindex:1,menu:1,noframes:1,ol:1,p:1,pre:1,table:1,ul:1}),Ic=x({area:1,base:1,basefont:1,br:1,col:1,command:1,
dialog:1,embed:1,hr:1,img:1,input:1,isindex:1,keygen:1,link:1,meta:1,param:1,source:1,track:1,wbr:1});ib=x({$nonBodyContent:D(Hc,sb,rb),$block:tb,$inline:u,$inlineWithA:D(x({a:1}),u),$body:D(x({script:1,style:1}),tb),$cdata:x({script:1,style:1}),$empty:Ic,$nonChild:x({iframe:1,textarea:1}),$listItem:x({dd:1,dt:1,li:1}),$list:x({ul:1,ol:1,dl:1}),$isNotEmpty:x({table:1,ul:1,ol:1,dl:1,iframe:1,area:1,base:1,col:1,hr:1,img:1,embed:1,input:1,link:1,meta:1,param:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1}),$removeEmpty:x({a:1,
abbr:1,acronym:1,address:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,s:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,"var":1}),$removeEmptyBlock:x({p:1,div:1}),$tableContent:x({caption:1,col:1,colgroup:1,tbody:1,td:1,tfoot:1,th:1,thead:1,tr:1,table:1}),$notTransContent:x({pre:1,script:1,style:1,textarea:1}),html:sb,head:Gc,style:ea,script:ea,body:K,base:{},link:{},meta:{},title:ea,col:{},tr:x({td:1,th:1}),img:{},embed:{},colgroup:x({thead:1,
col:1,tbody:1,tr:1,tfoot:1}),noscript:K,td:K,br:{},th:K,center:K,kbd:u,button:D(pa,oa),basefont:{},h5:u,h4:u,samp:u,h6:u,ol:qa,h1:u,h3:u,option:ea,h2:u,form:D(Ea,Fa,oa,pa),select:x({optgroup:1,option:1}),font:u,ins:u,menu:qa,abbr:u,label:u,table:x({thead:1,col:1,tbody:1,tr:1,colgroup:1,caption:1,tfoot:1}),code:u,tfoot:Ga,cite:u,li:K,input:{},iframe:K,strong:u,textarea:ea,noframes:K,big:u,small:u,span:x({"#":1,br:1}),hr:u,dt:u,sub:u,optgroup:x({option:1}),param:{},bdo:u,"var":u,div:K,object:qb,sup:u,
dd:K,strike:u,area:{},dir:qa,map:D(x({area:1,form:1,p:1}),Ea,lb,oa),applet:qb,dl:x({dt:1,dd:1}),del:u,isindex:{},fieldset:D(x({legend:1}),pb),thead:Ga,ul:qa,acronym:u,b:u,a:D(x({a:1}),ob),blockquote:D(x({td:1,tr:1,tbody:1,li:1}),K),caption:u,i:u,u:u,tbody:Ga,s:u,address:D(Fa,pa),tt:u,legend:u,q:u,pre:D(mb,kb),p:D(x({a:1}),u),em:u,dfn:u});var t=Ec.dtd=ib,ub=I&&9>n.version?{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",
rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder"}:{tabindex:"tabIndex",readonly:"readOnly"},Jc=p.listToMap("-webkit-box -moz-box block list-item table table-row-group table-header-group table-footer-group table-row table-column-group table-column table-cell table-caption".split(" ")),f=R.domUtils={NODE_ELEMENT:1,NODE_DOCUMENT:9,NODE_TEXT:3,NODE_COMMENT:8,NODE_DOCUMENT_FRAGMENT:11,POSITION_IDENTICAL:0,POSITION_DISCONNECTED:1,POSITION_FOLLOWING:2,POSITION_PRECEDING:4,POSITION_IS_CONTAINED:8,
POSITION_CONTAINS:16,fillChar:I&&"6"==n.version?"\ufeff":"\u200b",keys:{8:1,46:1,16:1,17:1,18:1,37:1,38:1,39:1,40:1,13:1},getPosition:function(a,b){if(a===b)return 0;var c,d=[a],e=[b];for(c=a;c=c.parentNode;){if(c===b)return 10;d.push(c)}for(c=b;c=c.parentNode;){if(c===a)return 20;e.push(c)}d.reverse();e.reverse();if(d[0]!==e[0])return 1;for(c=-1;c++,d[c]===e[c];);a=d[c];for(b=e[c];a=a.nextSibling;)if(a===b)return 4;return 2},getNodeIndex:function(a,b){for(var c=a,d=0;c=c.previousSibling;)b&&3==c.nodeType?
c.nodeType!=c.nextSibling.nodeType&&d++:d++;return d},inDoc:function(a,b){return 10==f.getPosition(a,b)},findParent:function(a,b,c){if(a&&!f.isBody(a))for(a=c?a:a.parentNode;a;){if(!b||b(a)||f.isBody(a))return b&&!b(a)&&f.isBody(a)?null:a;a=a.parentNode}return null},findParentByTagName:function(a,b,c,d){b=p.listToMap(p.isArray(b)?b:[b]);return f.findParent(a,function(a){return b[a.tagName]&&!(d&&d(a))},c)},findParents:function(a,b,c,d){for(b=b&&(c&&c(a)||!c)?[a]:[];a=f.findParent(a,c);)b.push(a);
return d?b:b.reverse()},insertAfter:function(a,b){return a.parentNode.insertBefore(b,a.nextSibling)},remove:function(a,b){var c=a.parentNode,d;if(c){if(b&&a.hasChildNodes())for(;d=a.firstChild;)c.insertBefore(d,a);c.removeChild(a)}return a},getNextDomNode:function(a,b,c,d){return Ba(a,"firstChild","nextSibling",b,c,d)},isBookmarkNode:function(a){return 1==a.nodeType&&a.id&&/^_baidu_bookmark_/i.test(a.id)},getWindow:function(a){a=a.ownerDocument||a;return a.defaultView||a.parentWindow},getCommonAncestor:function(a,
b){if(a===b)return a;for(var c=[a],d=[b],e=a,g=-1;e=e.parentNode;){if(e===b)return e;c.push(e)}for(e=b;e=e.parentNode;){if(e===a)return e;d.push(e)}c.reverse();for(d.reverse();g++,c[g]===d[g];);return 0==g?null:c[g-1]},clearEmptySibling:function(a,b,c){function d(a,b){for(var c;a&&!f.isBookmarkNode(a)&&(f.isEmptyInlineElement(a)||!RegExp("[^\t\n\r"+f.fillChar+"]").test(a.nodeValue));)c=a[b],f.remove(a),a=c}!b&&d(a.nextSibling,"nextSibling");!c&&d(a.previousSibling,"previousSibling")},split:function(a,
b){var c=a.ownerDocument;if(n.ie&&b==a.nodeValue.length){var d=c.createTextNode("");return f.insertAfter(a,d)}d=a.splitText(b);n.ie8&&(c=c.createTextNode(""),f.insertAfter(d,c),f.remove(c));return d},isWhitespace:function(a){return!RegExp("[^ \t\n\r"+f.fillChar+"]").test(a.nodeValue)},getXY:function(a){for(var b=0,c=0;a.offsetParent;)c+=a.offsetTop,b+=a.offsetLeft,a=a.offsetParent;return{x:b,y:c}},on:function(a,b,c){var d=p.isArray(b)?b:[b],e=d.length;if(e)for(;e--;)if(b=d[e],a.addEventListener)a.addEventListener(b,
c,!1);else{c._d||(c._d={els:[]});var g=b+c.toString(),f=p.indexOf(c._d.els,a);if(!c._d[g]||-1==f)-1==f&&c._d.els.push(a),c._d[g]||(c._d[g]=function(a){return c.call(a.srcElement,a||window.event)}),a.attachEvent("on"+b,c._d[g])}a=null},un:function(a,b,c){var d=p.isArray(b)?b:[b],e=d.length;if(e)for(;e--;)if(b=d[e],a.removeEventListener)a.removeEventListener(b,c,!1);else{var g=b+c.toString();try{a.detachEvent("on"+b,c._d?c._d[g]:c)}catch(f){}c._d&&c._d[g]&&(b=p.indexOf(c._d.els,a),-1!=b&&c._d.els.splice(b,
1),0==c._d.els.length&&delete c._d[g])}},isSameElement:function(a,b){if(a.tagName!=b.tagName)return!1;var c=a.attributes,d=b.attributes;if(!I&&c.length!=d.length)return!1;for(var e,g,h=0,j=0,l=0;e=c[l++];){if("style"==e.nodeName)if(e.specified&&h++,f.isSameStyle(a,b))continue;else return!1;if(I)if(e.specified)h++,g=d.getNamedItem(e.nodeName);else continue;else g=b.attributes[e.nodeName];if(!g.specified||e.nodeValue!=g.nodeValue)return!1}if(I){for(l=0;g=d[l++];)g.specified&&j++;if(h!=j)return!1}return!0},
isSameStyle:function(a,b){var c=a.style.cssText.replace(/( ?; ?)/g,";").replace(/( ?: ?)/g,":"),d=b.style.cssText.replace(/( ?; ?)/g,";").replace(/( ?: ?)/g,":");if(n.opera){c=a.style;d=b.style;if(c.length!=d.length)return!1;for(var e in c)if(!/^(\d+|csstext)$/i.test(e)&&c[e]!=d[e])return!1;return!0}if(!c||!d)return c==d;c=c.split(";");d=d.split(";");if(c.length!=d.length)return!1;e=0;for(var g;g=c[e++];)if(-1==p.indexOf(d,g))return!1;return!0},isBlockElm:function(a){return 1==a.nodeType&&(t.$block[a.tagName]||
Jc[f.getComputedStyle(a,"display")])&&!t.$nonChild[a.tagName]},isBody:function(a){return a&&1==a.nodeType&&"body"==a.tagName.toLowerCase()},breakParent:function(a,b){var c,d=a,e=a,g,h;do{d=d.parentNode;g?(c=d.cloneNode(!1),c.appendChild(g),g=c,c=d.cloneNode(!1),c.appendChild(h),h=c):(g=d.cloneNode(!1),h=g.cloneNode(!1));for(;c=e.previousSibling;)g.insertBefore(c,g.firstChild);for(;c=e.nextSibling;)h.appendChild(c);e=d}while(b!==d);c=b.parentNode;c.insertBefore(g,b);c.insertBefore(h,b);c.insertBefore(a,
h);f.remove(b);return a},isEmptyInlineElement:function(a){if(1!=a.nodeType||!t.$removeEmpty[a.tagName])return 0;for(a=a.firstChild;a;){if(f.isBookmarkNode(a)||1==a.nodeType&&!f.isEmptyInlineElement(a)||3==a.nodeType&&!f.isWhitespace(a))return 0;a=a.nextSibling}return 1},trimWhiteTextNode:function(a){function b(b){for(var d;(d=a[b])&&3==d.nodeType&&f.isWhitespace(d);)a.removeChild(d)}b("firstChild");b("lastChild")},mergeChild:function(a,b,c){b=f.getElementsByTagName(a,a.tagName.toLowerCase());for(var d=
0,e;e=b[d++];)if(e.parentNode&&!f.isBookmarkNode(e))if("span"==e.tagName.toLowerCase()){if(a===e.parentNode&&(f.trimWhiteTextNode(a),1==a.childNodes.length)){a.style.cssText=e.style.cssText+";"+a.style.cssText;f.remove(e,!0);continue}e.style.cssText=a.style.cssText+";"+e.style.cssText;if(c){var g=c.style;if(g)for(var g=g.split(";"),h=0,j;j=g[h++];)e.style[p.cssStyleToDomStyle(j.split(":")[0])]=j.split(":")[1]}f.isSameStyle(e,a)&&f.remove(e,!0)}else f.isSameElement(a,e)&&f.remove(e,!0)},getElementsByTagName:function(a,
b,c){if(c&&p.isString(c)){var d=c;c=function(a){return f.hasClass(a,d)}}b=p.trim(b).replace(/[ ]{2,}/g," ").split(" ");for(var e=[],g=0,h;h=b[g++];){h=a.getElementsByTagName(h);for(var j=0,l;l=h[j++];)(!c||c(l))&&e.push(l)}return e},mergeToParent:function(a){for(var b=a.parentNode;b&&t.$removeEmpty[b.tagName];){if(b.tagName==a.tagName||"A"==b.tagName){f.trimWhiteTextNode(b);if("SPAN"==b.tagName&&!f.isSameStyle(b,a)||"A"==b.tagName&&"SPAN"==a.tagName)if(1<b.childNodes.length||b!==a.parentNode){a.style.cssText=
b.style.cssText+";"+a.style.cssText;b=b.parentNode;continue}else b.style.cssText+=";"+a.style.cssText,"A"==b.tagName&&(b.style.textDecoration="underline");if("A"!=b.tagName){b===a.parentNode&&f.remove(a,!0);break}}b=b.parentNode}},mergeSibling:function(a,b,c){function d(a,b,c){var d;if((d=c[a])&&!f.isBookmarkNode(d)&&1==d.nodeType&&f.isSameElement(c,d)){for(;d.firstChild;)"firstChild"==b?c.insertBefore(d.lastChild,c.firstChild):c.appendChild(d.firstChild);f.remove(d)}}!b&&d("previousSibling","firstChild",
a);!c&&d("nextSibling","lastChild",a)},unSelectable:I||n.opera?function(a){a.onselectstart=function(){return!1};a.onclick=a.onkeyup=a.onkeydown=function(){return!1};a.unselectable="on";a.setAttribute("unselectable","on");for(var b=0,c;c=a.all[b++];)switch(c.tagName.toLowerCase()){case "iframe":case "textarea":case "input":case "select":break;default:c.unselectable="on",a.setAttribute("unselectable","on")}}:function(a){a.style.MozUserSelect=a.style.webkitUserSelect=a.style.KhtmlUserSelect="none"},
removeAttributes:function(a,b){b=p.isArray(b)?b:p.trim(b).replace(/[ ]{2,}/g," ").split(" ");for(var c=0,d;d=b[c++];){d=ub[d]||d;switch(d){case "className":a[d]="";break;case "style":a.style.cssText="",!n.ie&&a.removeAttributeNode(a.getAttributeNode("style"))}a.removeAttribute(d)}},createElement:function(a,b,c){return f.setAttributes(a.createElement(b),c)},setAttributes:function(a,b){for(var c in b)if(b.hasOwnProperty(c)){var d=b[c];switch(c){case "class":a.className=d;break;case "style":a.style.cssText=
a.style.cssText+";"+d;break;case "innerHTML":a[c]=d;break;case "value":a.value=d;break;default:a.setAttribute(ub[c]||c,d)}}return a},getComputedStyle:function(a,b){if(-1<"width height top left".indexOf(b))return a["offset"+b.replace(/^\w/,function(a){return a.toUpperCase()})]+"px";3==a.nodeType&&(a=a.parentNode);if(n.ie&&9>n.version&&"font-size"==b&&!a.style.fontSize&&!t.$empty[a.tagName]&&!t.$nonChild[a.tagName]){var c=a.ownerDocument.createElement("span");c.style.cssText="padding:0;border:0;font-family:simsun;";
c.innerHTML=".";a.appendChild(c);var d=c.offsetHeight;a.removeChild(c);c=null;return d+"px"}try{c=f.getStyle(a,b)||(window.getComputedStyle?f.getWindow(a).getComputedStyle(a,"").getPropertyValue(b):(a.currentStyle||a.style)[p.cssStyleToDomStyle(b)])}catch(e){return""}return p.transUnitToPx(p.fixColor(b,c))},removeClasses:function(a,b){b=p.isArray(b)?b:p.trim(b).replace(/[ ]{2,}/g," ").split(" ");for(var c=0,d,e=a.className;d=b[c++];)e=e.replace(RegExp("\\b"+d+"\\b"),"");(e=p.trim(e).replace(/[ ]{2,}/g,
" "))?a.className=e:f.removeAttributes(a,["class"])},addClass:function(a,b){if(a){b=p.trim(b).replace(/[ ]{2,}/g," ").split(" ");for(var c=0,d,e=a.className;d=b[c++];)RegExp("\\b"+d+"\\b").test(e)||(a.className+=" "+d)}},hasClass:function(a,b){if(p.isRegExp(b))return b.test(a.className);b=p.trim(b).replace(/[ ]{2,}/g," ").split(" ");for(var c=0,d,e=a.className;d=b[c++];)if(!RegExp("\\b"+d+"\\b","i").test(e))return!1;return c-1==b.length},preventDefault:function(a){a.preventDefault?a.preventDefault():
a.returnValue=!1},removeStyle:function(a,b){n.ie?a.style.cssText=a.style.cssText.replace(RegExp(b+"[^:]*:[^;]+;?","ig"),""):a.style.removeProperty?a.style.removeProperty(b):a.style.removeAttribute(p.cssStyleToDomStyle(b));a.style.cssText||f.removeAttributes(a,["style"])},getStyle:function(a,b){var c=a.style[p.cssStyleToDomStyle(b)];return p.fixColor(b,c)},setStyle:function(a,b,c){a.style[p.cssStyleToDomStyle(b)]=c;p.trim(a.style.cssText)||this.removeAttributes(a,"style")},setStyles:function(a,b){for(var c in b)b.hasOwnProperty(c)&&
f.setStyle(a,c,b[c])},removeDirtyAttr:function(a){for(var b=0,c,d=a.getElementsByTagName("*");c=d[b++];)c.removeAttribute("_moz_dirty");a.removeAttribute("_moz_dirty")},getChildCount:function(a,b){var c=0,d=a.firstChild;for(b=b||function(){return 1};d;)b(d)&&c++,d=d.nextSibling;return c},isEmptyNode:function(a){return!a.firstChild||0==f.getChildCount(a,function(a){return!f.isBr(a)&&!f.isBookmarkNode(a)&&!f.isWhitespace(a)})},clearSelectedArr:function(a){for(var b;b=a.pop();)f.removeAttributes(b,["class"])},
scrollToView:function(a,b,c){var d=b.document,d=("CSS1Compat"==d.compatMode?d.documentElement.clientHeight:d.body.clientHeight)||0;c=-1*d+c+(a.offsetHeight||0);a=f.getXY(a);c+=a.y;"pageXOffset"in b?a=b.pageYOffset||0:(a=b.document,a=a.documentElement.scrollTop||a.body.scrollTop||0);if(c>a||c<a-d)b.scrollTo(0,c+(0>c?-20:20))},isBr:function(a){return 1==a.nodeType&&"BR"==a.tagName},isFillChar:function(a,b){return 3==a.nodeType&&!a.nodeValue.replace(RegExp((b?"^":"")+f.fillChar),"").length},isStartInblock:function(a){a=
a.cloneRange();var b=0,c=a.startContainer,d;if(1==c.nodeType&&c.childNodes[a.startOffset])for(var c=c.childNodes[a.startOffset],e=c.previousSibling;e&&f.isFillChar(e);)c=e,e=e.previousSibling;this.isFillChar(c,!0)&&1==a.startOffset&&(a.setStartBefore(c),c=a.startContainer);for(;c&&f.isFillChar(c);)d=c,c=c.previousSibling;d&&(a.setStartBefore(d),c=a.startContainer);for(1==c.nodeType&&(f.isEmptyNode(c)&&1==a.startOffset)&&a.setStart(c,0).collapse(!0);!a.startOffset;){c=a.startContainer;if(f.isBlockElm(c)||
f.isBody(c)){b=1;break}var e=a.startContainer.previousSibling,g;if(e){for(;e&&f.isFillChar(e);)g=e,e=e.previousSibling;g?a.setStartBefore(g):a.setStartBefore(a.startContainer)}else a.setStartBefore(a.startContainer)}return b&&!f.isBody(a.startContainer)?1:0},isEmptyBlock:function(a,b){b=b||RegExp("[ \t\r\n"+f.fillChar+"]","g");if(0<a[n.ie?"innerText":"textContent"].replace(b,"").length)return 0;for(var c in t.$isNotEmpty)if(a.getElementsByTagName(c).length)return 0;return 1},setViewportOffset:function(a,
b){var c=parseInt(a.style.left)|0,d=parseInt(a.style.top)|0,e=a.getBoundingClientRect(),g=b.left-e.left,e=b.top-e.top;g&&(a.style.left=c+g+"px");e&&(a.style.top=d+e+"px")},fillNode:function(a,b){var c=n.ie?a.createTextNode(f.fillChar):a.createElement("br");b.innerHTML="";b.appendChild(c)},moveChild:function(a,b,c){for(;a.firstChild;)c&&b.firstChild?b.insertBefore(a.lastChild,b.firstChild):b.appendChild(a.firstChild)},hasNoAttributes:function(a){return n.ie?/^<\w+\s*?>/.test(a.outerHTML):0==a.attributes.length},
isCustomeNode:function(a){return 1==a.nodeType&&a.getAttribute("_ue_custom_node_")},isTagNode:function(a,b){return 1==a.nodeType&&RegExp(a.tagName,"i").test(b)},filterNodeList:function(a,b,c){var d=[];if(!p.isFunction(b)){var e=b;b=function(a){return-1!=p.indexOf(p.isArray(e)?e:e.split(" "),a.tagName.toLowerCase())}}p.each(a,function(a){b(a)&&d.push(a)});return 0==d.length?null:1==d.length||!c?d[0]:d},isInNodeEndBoundary:function(a,b){var c=a.startContainer;if(3==c.nodeType&&a.startOffset!=c.nodeValue.length||
1==c.nodeType&&a.startOffset!=c.childNodes.length)return 0;for(;c!==b;){if(c.nextSibling)return 0;c=c.parentNode}return 1},isBoundaryNode:function(a,b){for(var c;!f.isBody(a);)if(c=a,a=a.parentNode,c!==a[b])return!1;return!0}},fa=RegExp(f.fillChar,"g"),vb=function(a){return!a.collapsed&&1==a.startContainer.nodeType&&a.startContainer===a.endContainer&&1==a.endOffset-a.startOffset},wb=function(a,b,c,d){if(1==b.nodeType&&(t.$empty[b.tagName]||t.$nonChild[b.tagName]))c=f.getNodeIndex(b)+(a?0:1),b=b.parentNode;
a?(d.startContainer=b,d.startOffset=c,d.endContainer||d.collapse(!0)):(d.endContainer=b,d.endOffset=c,d.startContainer||d.collapse(!1));d.collapsed=d.startContainer&&d.endContainer&&d.startContainer===d.endContainer&&d.startOffset==d.endOffset;return d},Ha=function(a,b){var c=a.startContainer,d=a.endContainer,e=a.startOffset,g=a.endOffset,h=a.document,j=h.createDocumentFragment(),l,k;1==c.nodeType&&(c=c.childNodes[e]||(l=c.appendChild(h.createTextNode(""))));1==d.nodeType&&(d=d.childNodes[g]||(k=
d.appendChild(h.createTextNode(""))));if(c===d&&3==c.nodeType)return j.appendChild(h.createTextNode(c.substringData(e,g-e))),b&&(c.deleteData(e,g-e),a.collapse(!0)),j;for(var m,p,n=j,E=f.findParents(c,!0),s=f.findParents(d,!0),A=0;E[A]==s[A];)A++;for(var X=A,Q;Q=E[X];X++){m=Q.nextSibling;Q==c?l||(3==a.startContainer.nodeType?(n.appendChild(h.createTextNode(c.nodeValue.slice(e))),b&&c.deleteData(e,c.nodeValue.length-e)):n.appendChild(!b?c.cloneNode(!0):c)):(p=Q.cloneNode(!1),n.appendChild(p));for(;m&&
!(m===d||m===s[X]);)Q=m.nextSibling,n.appendChild(!b?m.cloneNode(!0):m),m=Q;n=p}n=j;E[A]||(n.appendChild(E[A-1].cloneNode(!1)),n=n.firstChild);for(X=A;e=s[X];X++){m=e.previousSibling;e==d?!k&&3==a.endContainer.nodeType&&(n.appendChild(h.createTextNode(d.substringData(0,g))),b&&d.deleteData(0,g)):(p=e.cloneNode(!1),n.appendChild(p));if(X!=A||!E[A])for(;m&&m!==c;)e=m.previousSibling,n.insertBefore(!b?m.cloneNode(!0):m,n.firstChild),m=e;n=p}b&&a.setStartBefore(!s[A]?s[A-1]:!E[A]?E[A-1]:s[A]).collapse(!0);
l&&f.remove(l);k&&f.remove(k);return j},xb=function(a,b){try{if(J&&f.inDoc(J,a))if(J.nodeValue.replace(fa,"").length)J.nodeValue=J.nodeValue.replace(fa,"");else{var c=J.parentNode;for(f.remove(J);c&&f.isEmptyInlineElement(c)&&(n.safari?!(f.getPosition(c,b)&f.POSITION_CONTAINS):!c.contains(b));)J=c.parentNode,f.remove(c),c=J}}catch(d){}},ra=function(a,b){var c;for(a=a[b];a&&f.isFillChar(a);)c=a[b],f.remove(a),a=c},yb=0,Ia=f.fillChar,J,zb=R.Range=function(a){this.startContainer=this.startOffset=this.endContainer=
this.endOffset=null;this.document=a;this.collapsed=!0};zb.prototype={cloneContents:function(){return this.collapsed?null:Ha(this,0)},deleteContents:function(){var a;this.collapsed||Ha(this,1);n.webkit&&(a=this.startContainer,3==a.nodeType&&!a.nodeValue.length&&(this.setStartBefore(a).collapse(!0),f.remove(a)));return this},extractContents:function(){return this.collapsed?null:Ha(this,2)},setStart:function(a,b){return wb(!0,a,b,this)},setEnd:function(a,b){return wb(!1,a,b,this)},setStartAfter:function(a){return this.setStart(a.parentNode,
f.getNodeIndex(a)+1)},setStartBefore:function(a){return this.setStart(a.parentNode,f.getNodeIndex(a))},setEndAfter:function(a){return this.setEnd(a.parentNode,f.getNodeIndex(a)+1)},setEndBefore:function(a){return this.setEnd(a.parentNode,f.getNodeIndex(a))},setStartAtFirst:function(a){return this.setStart(a,0)},setStartAtLast:function(a){return this.setStart(a,3==a.nodeType?a.nodeValue.length:a.childNodes.length)},setEndAtFirst:function(a){return this.setEnd(a,0)},setEndAtLast:function(a){return this.setEnd(a,
3==a.nodeType?a.nodeValue.length:a.childNodes.length)},selectNode:function(a){return this.setStartBefore(a).setEndAfter(a)},selectNodeContents:function(a){return this.setStart(a,0).setEndAtLast(a)},cloneRange:function(){return(new zb(this.document)).setStart(this.startContainer,this.startOffset).setEnd(this.endContainer,this.endOffset)},collapse:function(a){a?(this.endContainer=this.startContainer,this.endOffset=this.startOffset):(this.startContainer=this.endContainer,this.startOffset=this.endOffset);
this.collapsed=!0;return this},shrinkBoundary:function(a){function b(a){return 1==a.nodeType&&!f.isBookmarkNode(a)&&!t.$empty[a.tagName]&&!t.$nonChild[a.tagName]}for(var c,d=this.collapsed;1==this.startContainer.nodeType&&(c=this.startContainer.childNodes[this.startOffset])&&b(c);)this.setStart(c,0);if(d)return this.collapse(!0);if(!a)for(;1==this.endContainer.nodeType&&0<this.endOffset&&(c=this.endContainer.childNodes[this.endOffset-1])&&b(c);)this.setEnd(c,c.childNodes.length);return this},getCommonAncestor:function(a,
b){var c=this.startContainer,d=this.endContainer;return c===d?a&&vb(this)&&(c=c.childNodes[this.startOffset],1==c.nodeType)?c:b&&3==c.nodeType?c.parentNode:c:f.getCommonAncestor(c,d)},trimBoundary:function(a){this.txtToElmBoundary();var b=this.startContainer,c=this.startOffset,d=this.collapsed,e=this.endContainer;if(3==b.nodeType){if(0==c)this.setStartBefore(b);else if(c>=b.nodeValue.length)this.setStartAfter(b);else{var g=f.split(b,c);b===e?this.setEnd(g,this.endOffset-c):b.parentNode===e&&(this.endOffset+=
1);this.setStartBefore(g)}if(d)return this.collapse(!0)}a||(c=this.endOffset,e=this.endContainer,3==e.nodeType&&(0==c?this.setEndBefore(e):(c<e.nodeValue.length&&f.split(e,c),this.setEndAfter(e))));return this},txtToElmBoundary:function(){function a(a,c){var d=a[c+"Container"],e=a[c+"Offset"];if(3==d.nodeType)if(e){if(e>=d.nodeValue.length)a["set"+c.replace(/(\w)/,function(a){return a.toUpperCase()})+"After"](d)}else a["set"+c.replace(/(\w)/,function(a){return a.toUpperCase()})+"Before"](d)}this.collapsed||
(a(this,"start"),a(this,"end"));return this},insertNode:function(a){var b=a,c=1;11==a.nodeType&&(b=a.firstChild,c=a.childNodes.length);this.trimBoundary(!0);var d=this.startContainer,e=d.childNodes[this.startOffset];e?d.insertBefore(a,e):d.appendChild(a);b.parentNode===this.endContainer&&(this.endOffset+=c);return this.setStartBefore(b)},setCursor:function(a,b){return this.collapse(!a).select(b)},createBookmark:function(a,b){var c,d=this.document.createElement("span");d.style.cssText="display:none;line-height:0px;";
d.appendChild(this.document.createTextNode("\u200d"));d.id="_baidu_bookmark_start_"+(b?"":yb++);this.collapsed||(c=d.cloneNode(!0),c.id="_baidu_bookmark_end_"+(b?"":yb++));this.insertNode(d);c&&this.collapse().insertNode(c).setEndBefore(c);this.setStartAfter(d);return{start:a?d.id:d,end:c?a?c.id:c:null,id:a}},moveToBookmark:function(a){var b=a.id?this.document.getElementById(a.start):a.start;a=a.end&&a.id?this.document.getElementById(a.end):a.end;this.setStartBefore(b);f.remove(b);a?(this.setEndBefore(a),
f.remove(a)):this.collapse(!0);return this},enlarge:function(a,b){var c=f.isBody,d,e,g=this.document.createTextNode("");if(a){e=this.startContainer;1==e.nodeType?e.childNodes[this.startOffset]?d=e=e.childNodes[this.startOffset]:(e.appendChild(g),d=e=g):d=e;for(;;){if(f.isBlockElm(e)){for(e=d;(d=e.previousSibling)&&!f.isBlockElm(d);)e=d;this.setStartBefore(e);break}d=e;e=e.parentNode}e=this.endContainer;1==e.nodeType?((d=e.childNodes[this.endOffset])?e.insertBefore(g,d):e.appendChild(g),d=e=g):d=e;
for(;;){if(f.isBlockElm(e)){for(e=d;(d=e.nextSibling)&&!f.isBlockElm(d);)e=d;this.setEndAfter(e);break}d=e;e=e.parentNode}g.parentNode===this.endContainer&&this.endOffset--;f.remove(g)}if(!this.collapsed){for(;0==this.startOffset&&(!b||!b(this.startContainer))&&!c(this.startContainer);)this.setStartBefore(this.startContainer);for(;this.endOffset==(1==this.endContainer.nodeType?this.endContainer.childNodes.length:this.endContainer.nodeValue.length)&&(!b||!b(this.endContainer))&&!c(this.endContainer);)this.setEndAfter(this.endContainer)}return this},
adjustmentBoundary:function(){if(!this.collapsed){for(;!f.isBody(this.startContainer)&&this.startOffset==this.startContainer[3==this.startContainer.nodeType?"nodeValue":"childNodes"].length&&this.startContainer[3==this.startContainer.nodeType?"nodeValue":"childNodes"].length;)this.setStartAfter(this.startContainer);for(;!f.isBody(this.endContainer)&&!this.endOffset&&this.endContainer[3==this.endContainer.nodeType?"nodeValue":"childNodes"].length;)this.setEndBefore(this.endContainer)}return this},
applyInlineStyle:function(a,b,c){if(this.collapsed)return this;this.trimBoundary().enlarge(!1,function(a){return 1==a.nodeType&&f.isBlockElm(a)}).adjustmentBoundary();for(var d=this.createBookmark(),e=d.end,g=function(a){return 1==a.nodeType?"br"!=a.tagName.toLowerCase():!f.isWhitespace(a)},h=f.getNextDomNode(d.start,!1,g),j,l,k=this.cloneRange();h&&f.getPosition(h,e)&f.POSITION_PRECEDING;)if(3==h.nodeType||t[a][h.tagName]){k.setStartBefore(h);for(j=h;j&&(3==j.nodeType||t[a][j.tagName])&&j!==e;)l=
j,j=f.getNextDomNode(j,1==j.nodeType,null,function(b){return t[a][b.tagName]});var h=k.setEndAfter(l).extractContents(),m;if(c&&0<c.length){var p;p=m=c[0].cloneNode(!1);for(var n=1,E;E=c[n++];)m.appendChild(E.cloneNode(!1)),m=m.firstChild}else m=k.document.createElement(a);b&&f.setAttributes(m,b);m.appendChild(h);k.insertNode(c?p:m);var s;"span"==a&&b.style&&/text\-decoration/.test(b.style)&&(s=f.findParentByTagName(m,"a",!0))?(f.setAttributes(s,b),f.remove(m,!0),m=s):(f.mergeSibling(m),f.clearEmptySibling(m));
f.mergeChild(m,b);h=f.getNextDomNode(m,!1,g);f.mergeToParent(m);if(j===e)break}else h=f.getNextDomNode(h,!0,g);return this.moveToBookmark(d)},removeInlineStyle:function(a){if(this.collapsed)return this;a=p.isArray(a)?a:[a];this.shrinkBoundary().adjustmentBoundary();for(var b=this.startContainer,c=this.endContainer;;){if(1==b.nodeType){if(-1<p.indexOf(a,b.tagName.toLowerCase()))break;if("body"==b.tagName.toLowerCase()){b=null;break}}b=b.parentNode}for(;;){if(1==c.nodeType){if(-1<p.indexOf(a,c.tagName.toLowerCase()))break;
if("body"==c.tagName.toLowerCase()){c=null;break}}c=c.parentNode}var d=this.createBookmark(),e,g;b&&(g=this.cloneRange().setEndBefore(d.start).setStartBefore(b),e=g.extractContents(),g.insertNode(e),f.clearEmptySibling(b,!0),b.parentNode.insertBefore(d.start,b));c&&(g=this.cloneRange().setStartAfter(d.end).setEndAfter(c),e=g.extractContents(),g.insertNode(e),f.clearEmptySibling(c,!1,!0),c.parentNode.insertBefore(d.end,c.nextSibling));for(b=f.getNextDomNode(d.start,!1,function(a){return 1==a.nodeType});b&&
b!==d.end;)c=f.getNextDomNode(b,!0,function(a){return 1==a.nodeType}),-1<p.indexOf(a,b.tagName.toLowerCase())&&f.remove(b,!0),b=c;return this.moveToBookmark(d)},getClosedNode:function(){var a;if(!this.collapsed){var b=this.cloneRange().adjustmentBoundary().shrinkBoundary();if(vb(b)&&(b=b.startContainer.childNodes[b.startOffset])&&1==b.nodeType&&(t.$empty[b.tagName]||t.$nonChild[b.tagName]))a=b}return a},select:n.ie?function(a,b){var c;this.collapsed||this.shrinkBoundary();var d=this.getClosedNode();
if(d&&!b){try{c=this.document.body.createControlRange(),c.addElement(d),c.select()}catch(e){}return this}var d=this.createBookmark(),g=d.start;c=this.document.body.createTextRange();c.moveToElementText(g);c.moveStart("character",1);if(this.collapsed){if(!a&&3!=this.startContainer.nodeType){var h=this.document.createTextNode(Ia),j=this.document.createElement("span");j.appendChild(this.document.createTextNode(Ia));g.parentNode.insertBefore(j,g);g.parentNode.insertBefore(h,g);xb(this.document,h);J=h;
ra(j,"previousSibling");ra(g,"nextSibling");c.moveStart("character",-1);c.collapse(!0)}}else h=this.document.body.createTextRange(),g=d.end,h.moveToElementText(g),c.setEndPoint("EndToEnd",h);this.moveToBookmark(d);j&&f.remove(j);try{c.select()}catch(l){}return this}:function(a){var b=f.getWindow(this.document),c=b.getSelection();n.gecko?this.document.body.focus():b.focus();if(c){c.removeAllRanges();if(this.collapsed&&!a&&(a=b=this.startContainer,1==b.nodeType&&(a=b.childNodes[this.startOffset]),!(3==
b.nodeType&&this.startOffset)&&(a?!a.previousSibling||3!=a.previousSibling.nodeType:!b.lastChild||3!=b.lastChild.nodeType)))a=this.document.createTextNode(Ia),this.insertNode(a),xb(this.document,a),ra(a,"previousSibling"),ra(a,"nextSibling"),J=a,this.setStart(a,n.webkit?1:0).collapse(!0);b=this.document.createRange();if(this.collapsed&&n.opera&&1==this.startContainer.nodeType)if(a=this.startContainer.childNodes[this.startOffset]){for(;a&&f.isBlockElm(a);)if(1==a.nodeType&&a.childNodes[0])a=a.childNodes[0];
else break;a&&this.setStartBefore(a).collapse(!0)}else(a=this.startContainer.lastChild)&&f.isBr(a)&&this.setStartBefore(a).collapse(!0);var d=this;a=function(a,b,c){3==a.nodeType&&a.nodeValue.length<b&&(d[c+"Offset"]=a.nodeValue.length)};a(d.startContainer,d.startOffset,"start");a(d.endContainer,d.endOffset,"end");b.setStart(this.startContainer,this.startOffset);b.setEnd(this.endContainer,this.endOffset);c.addRange(b)}return this},scrollToView:function(a,b){a=a?window:f.getWindow(this.document);var c=
this.document.createElement("span");c.innerHTML="&nbsp;";this.cloneRange().insertNode(c);f.scrollToView(c,a,b);f.remove(c);return this},inFillChar:function(){var a=this.startContainer;return this.collapsed&&3==a.nodeType&&a.nodeValue.replace(RegExp("^"+f.fillChar),"").length+1==a.nodeValue.length?!0:!1},createAddress:function(a,b){function c(a){for(var c=a?e.startContainer:e.endContainer,d=f.findParents(c,!0,function(a){return!f.isBody(a)}),l=[],k=0,m;m=d[k++];)l.push(f.getNodeIndex(m,b));d=0;if(b)if(3==
c.nodeType){for(c=c.previousSibling;c&&3==c.nodeType;)d+=c.nodeValue.replace(fa,"").length,c=c.previousSibling;d+=a?e.startOffset:e.endOffset}else if(c=c.childNodes[a?e.startOffset:e.endOffset])d=f.getNodeIndex(c,b);else{c=a?e.startContainer:e.endContainer;for(a=c.firstChild;a;)if(f.isFillChar(a))a=a.nextSibling;else if(d++,3==a.nodeType)for(;a&&3==a.nodeType;)a=a.nextSibling;else a=a.nextSibling}else d=a?f.isFillChar(c)?0:e.startOffset:e.endOffset;0>d&&(d=0);l.push(d);return l}var d={},e=this;d.startAddress=
c(!0);a||(d.endAddress=e.collapsed?[].concat(d.startAddress):c());return d},moveToAddress:function(a,b){function c(a,b){for(var c=d.document.body,f,l,k=0,m,p=a.length;k<p;k++)if(m=a[k],f=c,c=c.childNodes[m],!c){l=m;break}b?c?d.setStartBefore(c):d.setStart(f,l):c?d.setEndBefore(c):d.setEnd(f,l)}var d=this;c(a.startAddress,!0);!b&&a.endAddress&&c(a.endAddress);return d},equals:function(a){for(var b in this)if(this.hasOwnProperty(b)&&this[b]!==a[b])return!1;return!0},traversal:function(a,b){if(this.collapsed)return this;
for(var c=this.createBookmark(),d=c.end,e=f.getNextDomNode(c.start,!1,b);e&&e!==d&&f.getPosition(e,d)&f.POSITION_PRECEDING;){var g=f.getNextDomNode(e,!1,b);a(e);e=g}return this.moveToBookmark(c)}};var Ab=function(a,b){var c=f.getNodeIndex;a=a.duplicate();a.collapse(b);var d=a.parentElement();if(!d.hasChildNodes())return{container:d,offset:0};for(var e=d.children,g,h=a.duplicate(),j=0,l=e.length-1,k=-1;j<=l;){k=Math.floor((j+l)/2);g=e[k];h.moveToElementText(g);var m=h.compareEndPoints("StartToStart",
a);if(0<m)l=k-1;else if(0>m)j=k+1;else return{container:d,offset:c(g)}}if(-1==k){h.moveToElementText(d);h.setEndPoint("StartToStart",a);h=h.text.replace(/(\r\n|\r)/g,"\n").length;e=d.childNodes;if(!h)return g=e[e.length-1],{container:g,offset:g.nodeValue.length};for(c=e.length;0<h;)h-=e[--c].nodeValue.length;return{container:e[c],offset:-h}}h.collapse(0<m);h.setEndPoint(0<m?"StartToStart":"EndToStart",a);h=h.text.replace(/(\r\n|\r)/g,"\n").length;if(!h)return t.$empty[g.tagName]||t.$nonChild[g.tagName]?
{container:d,offset:c(g)+(0<m?0:1)}:{container:g,offset:0<m?0:g.childNodes.length};for(;0<h;)try{e=g,g=g[0<m?"previousSibling":"nextSibling"],h-=g.nodeValue.length}catch(p){return{container:d,offset:c(e)}}return{container:g,offset:0<m?-h:g.nodeValue.length+h}},Ja=function(a){var b;try{b=a.getNative().createRange()}catch(c){return null}var d=b.item?b.item(0):b.parentElement();return(d.ownerDocument||d)===a.document?b:null};(R.Selection=function(a){var b=this;b.document=a;I&&(a=f.getWindow(a).frameElement,
f.on(a,"beforedeactivate",function(){b._bakIERange=b.getIERange()}),f.on(a,"activate",function(){try{!Ja(b)&&b._bakIERange&&b._bakIERange.select()}catch(a){}b._bakIERange=null}));a=a=null}).prototype={getNative:function(){var a=this.document;try{return!a?null:I?a.selection:f.getWindow(a).getSelection()}catch(b){return null}},getIERange:function(){var a=Ja(this);return!a&&this._bakIERange?this._bakIERange:a},cache:function(){this.clear();this._cachedRange=this.getRange();this._cachedStartElement=this.getStart();
this._cachedStartElementPath=this.getStartElementPath()},getStartElementPath:function(){if(this._cachedStartElementPath)return this._cachedStartElementPath;var a=this.getStart();return a?f.findParents(a,!0,null,!0):[]},clear:function(){this._cachedStartElementPath=this._cachedRange=this._cachedStartElement=null},isFocus:function(){try{return n.ie&&Ja(this)||!n.ie&&this.getNative().rangeCount?!0:!1}catch(a){return!1}},getRange:function(){function a(a){for(var c=b.document.body.firstChild,d=a.collapsed;c&&
c.firstChild;)a.setStart(c,0),c=c.firstChild;a.startContainer||a.setStart(b.document.body,0);d&&a.collapse(!0)}var b=this;if(null!=b._cachedRange)return this._cachedRange;var c=new q.editor.dom.Range(b.document);if(I){var d=b.getIERange();if(d)try{if(d.item)c.selectNode(d.item(0));else{var e=Ab(d,!0);c.setStart(e.container,e.offset);0!=d.compareEndPoints("StartToEnd",d)&&(e=Ab(d,!1),c.setEnd(e.container,e.offset))}}catch(g){a(c)}else a(c)}else if((e=b.getNative())&&e.rangeCount)d=e.getRangeAt(0),
e=e.getRangeAt(e.rangeCount-1),c.setStart(d.startContainer,d.startOffset).setEnd(e.endContainer,e.endOffset),c.collapsed&&(f.isBody(c.startContainer)&&!c.startOffset)&&a(c);else{if(this._bakRange&&f.inDoc(this._bakRange.startContainer,this.document))return this._bakRange;a(c)}return this._bakRange=c},getStart:function(){if(this._cachedStartElement)return this._cachedStartElement;var a=I?this.getIERange():this.getRange(),b,c;if(I){if(!a)return this.document.body.firstChild;if(a.item)return a.item(0);
b=a.duplicate();0<b.text.length&&b.moveStart("character",1);b.collapse(1);b=b.parentElement();for(c=a=a.parentElement();a=a.parentNode;)if(a==b){b=c;break}}else if(a.shrinkBoundary(),b=a.startContainer,1==b.nodeType&&b.hasChildNodes()&&(b=b.childNodes[Math.min(b.childNodes.length-1,a.startOffset)]),3==b.nodeType)return b.parentNode;return b},getText:function(){var a;return this.isFocus()&&(a=this.getNative())?(a=n.ie?a.createRange():a.getRangeAt(0),n.ie?a.text:a.toString()):""},clearRange:function(){this.getNative()[n.ie?
"empty":"removeAllRanges"]()}};var sa=function(a,b){var c;if(b.textarea)if(p.isString(b.textarea))for(var d=0,e,g=f.getElementsByTagName(a,"textarea");e=g[d++];){if(e.id=="ueditor_textarea_"+b.options.textarea){c=e;break}}else c=b.textarea;c||(a.appendChild(c=f.createElement(document,"textarea",{name:b.options.textarea,id:"ueditor_textarea_"+b.options.textarea,style:"display:none"})),b.textarea=c);c.value=b.hasContents()?b.options.allHtmlEnabled?b.getAllHtml():b.getContent(null,null,!0):""},Kc=0,
Bb,Cb=UE.Editor=function(a){var b=this;b.uid=Kc++;Da.call(b);b.commands={};b.options=p.extend(p.clone(a||{}),UEDITOR_CONFIG,!0);b.shortcutkeys={};b.inputRules=[];b.outputRules=[];b.setOpt({isShow:!0,initialContent:"",initialStyle:"",autoClearinitialContent:!1,iframeCssUrl:b.options.UEDITOR_HOME_URL+"themes/iframe.css",textarea:"editorValue",focus:!1,focusInEnd:!0,autoClearEmptyNode:!0,fullscreen:!1,readonly:!1,zIndex:999,imagePopup:!0,enterTag:"p",customDomain:!1,lang:"zh-cn",langPath:b.options.UEDITOR_HOME_URL+
"lang/",theme:"default",themePath:b.options.UEDITOR_HOME_URL+"themes/",allHtmlEnabled:!1,scaleEnabled:!1,tableNativeEditInFF:!1,autoSyncData:!0});p.loadFile(document,{src:b.options.langPath+b.options.lang+"/"+b.options.lang+".js",tag:"script",type:"text/javascript",defer:"defer"},function(){for(var a in UE.plugins)UE.plugins[a].call(b);b.langIsReady=!0;b.fireEvent("langReady")});UE.instants["ueditorInstant"+b.uid]=b},Db=function(){var a=this;a.document.getElementById("initContent")&&(a.body.innerHTML=
"<p>"+(I?"":"<br/>")+"</p>",a.removeListener("firstBeforeExecCommand focus",Db),setTimeout(function(){a.focus();a._selectionChange()},0))};Cb.prototype={ready:function(a){a&&(this.isReady?a.apply(this):this.addListener("ready",a))},setOpt:function(a,b){var c={};p.isString(a)?c[a]=b:c=a;p.extend(this.options,c,!0)},destroy:function(){this.fireEvent("destroy");var a=this.container.parentNode,b=this.textarea;b?b.style.display="":(b=document.createElement("textarea"),a.parentNode.insertBefore(b,a));b.style.width=
this.iframe.offsetWidth+"px";b.style.height=this.iframe.offsetHeight+"px";b.value=this.getContent();b.id=this.key;a.innerHTML="";f.remove(a);var a=this.key,c;for(c in this)this.hasOwnProperty(c)&&delete this[c];UE.delEditor(a)},render:function(a){var b=this.options;p.isString(a)&&(a=document.getElementById(a));if(a){var c=I&&9>n.version,c=(I&&9>n.version?"":"<!DOCTYPE html>")+"<html xmlns='http://www.w3.org/1999/xhtml'"+(!c?" class='view'":"")+"><head>"+(b.iframeCssUrl?"<link rel='stylesheet' type='text/css' href='"+
p.unhtml(b.iframeCssUrl)+"'/>":"")+"<style type='text/css'>.view{padding:0;word-wrap:break-word;cursor:text;height:100%;}\nbody{margin:8px;font-family:sans-serif;font-size:16px;}p{margin:5px 0;}"+(b.initialStyle||"")+"</style></head><body"+(c?" class='view'":"")+"></body>";b.customDomain&&document.domain!=location.hostname?(c+="<script>window.parent.UE.instants['ueditorInstant"+this.uid+"']._setup(document);\x3c/script></html>",a.appendChild(f.createElement(document,"iframe",{id:"ueditor_"+this.uid,
width:"100%",height:"100%",frameborder:"0",src:'javascript:void(function(){document.open();document.domain="'+document.domain+'";document.write("'+c+'");document.close();}())'}))):(b.minFrameWidth=b.initialFrameWidth?b.initialFrameWidth:b.initialFrameWidth=a.offsetWidth,b.initialFrameHeight?b.minFrameHeight=b.initialFrameHeight:b.initialFrameHeight=b.minFrameHeight=a.offsetHeight,a.style.width=b.initialFrameWidth+"px",a.style.height=b.initialFrameHeight+"px",a.style.zIndex=b.zIndex,a.innerHTML='<iframe id="ueditor_'+
this.uid+'"width="100%" height="100%" scroll="no" frameborder="0" ></iframe>',b=a.firstChild.contentWindow.document,b.open(),b.write(c+"</html>"),b.close(),this._setup(b));a.style.overflow="hidden"}},_setup:function(a){var b=this,c=b.options;I?(a.body.disabled=!0,a.body.contentEditable=!0,a.body.disabled=!1):(a.body.contentEditable=!0,a.body.spellcheck=!1);b.document=a;b.window=a.defaultView||a.parentWindow;b.iframe=b.window.frameElement;b.body=a.body;b.selection=new R.Selection(a);var d;n.gecko&&
(d=this.selection.getNative())&&d.removeAllRanges();this._initEvents();for(var e=this.iframe.parentNode;!f.isBody(e);e=e.parentNode)if("FORM"==e.tagName){b.form=e;if(b.options.autoSyncData)f.on(b.window,"blur",function(){sa(e,b)});else f.on(e,"submit",function(){sa(this,b)});break}if(c.initialContent)if(c.autoClearinitialContent){var g=b.execCommand;b.execCommand=function(){b.fireEvent("firstBeforeExecCommand");return g.apply(b,arguments)};this._setDefaultContent(c.initialContent)}else this.setContent(c.initialContent,
!1,!0);f.isEmptyNode(b.body)&&(b.body.innerHTML="<p>"+(n.ie?"":"<br/>")+"</p>");c.focus&&setTimeout(function(){b.focus(b.options.focusInEnd);!b.options.autoClearinitialContent&&b._selectionChange()},0);b.container||(b.container=this.iframe.parentNode);c.fullscreen&&b.ui&&b.ui.setFullScreen(!0);try{b.document.execCommand("2D-position",!1,!1)}catch(h){}try{b.document.execCommand("enableInlineTableEditing",!1,!1)}catch(j){}try{b.document.execCommand("enableObjectResizing",!1,!1)}catch(l){}b._bindshortcutKeys();
b.isReady=1;b.fireEvent("ready");c.onready&&c.onready.call(b);if(!n.ie)f.on(b.window,["blur","focus"],function(a){if("blur"==a.type){b._bakRange=b.selection.getRange();try{b.selection.getNative().removeAllRanges()}catch(c){}}else try{b._bakRange&&b._bakRange.select()}catch(d){}});n.gecko&&10902>=n.version&&(b.body.contentEditable=!1,setTimeout(function(){b.body.contentEditable=!0},100),setInterval(function(){b.body.style.height=b.iframe.offsetHeight-20+"px"},100));!c.isShow&&b.setHide();c.readonly&&
b.setDisabled()},sync:function(a){(a=a?document.getElementById(a):f.findParent(this.iframe.parentNode,function(a){return"FORM"==a.tagName},!0))&&sa(a,this)},setHeight:function(a){a!==parseInt(this.iframe.parentNode.style.height)&&(this.iframe.parentNode.style.height=a+"px");this.document.body.style.height=a-20+"px"},addshortcutkey:function(a,b){var c={};b?c[a]=b:c=a;p.extend(this.shortcutkeys,c)},_bindshortcutKeys:function(){var a=this,b=this.shortcutkeys;a.addListener("keydown",function(c,d){var e=
d.keyCode||d.which,g;for(g in b)for(var h=b[g].split(","),j=0,l;l=h[j++];){l=l.split(":");var k=l[0];l=l[1];if(/^(ctrl)(\+shift)?\+(\d+)$/.test(k.toLowerCase())||/^(\d+)$/.test(k))if("ctrl"==RegExp.$1&&(d.ctrlKey||d.metaKey)&&(""!=RegExp.$2?d[RegExp.$2.slice(1)+"Key"]:1)&&e==RegExp.$3||e==RegExp.$1)-1!=a.queryCommandState(g,l)&&a.execCommand(g,l),f.preventDefault(d)}})},getContent:function(a,b,c,d,e){a&&p.isFunction(a)&&(b=a,a="");if(b?!b():!this.hasContents())return"";this.fireEvent("beforegetcontent");
b=UE.htmlparser(this.body.innerHTML,d);this.filterOutputRule(b);this.fireEvent("aftergetcontent",a);return b.toHtml(e)},getAllHtml:function(){var a=[];this.fireEvent("getAllHtml",a);if(n.ie&&8<n.version){var b="";p.each(this.document.styleSheets,function(a){b+=a.href?'<link rel="stylesheet" type="text/css" href="'+a.href+'" />':"<style>"+a.cssText+"</style>"});p.each(this.document.getElementsByTagName("script"),function(a){b+=a.outerHTML})}return"<html><head>"+(this.options.charset?'<meta http-equiv="Content-Type" content="text/html; charset='+
this.options.charset+'"/>':"")+(b||this.document.getElementsByTagName("head")[0].innerHTML)+a.join("\n")+"</head><body "+(I&&9>n.version?'class="view"':"")+">"+this.getContent(null,null,!0)+"</body></html>"},getPlainTxt:function(){var a=RegExp(f.fillChar,"g"),b=this.body.innerHTML.replace(/[\n\r]/g,""),b=b.replace(/<(p|div)[^>]*>(<br\/?>|&nbsp;)<\/\1>/gi,"\n").replace(/<br\/?>/gi,"\n").replace(/<[^>/]+>/g,"").replace(/(\n)?<\/([^>]+)>/g,function(a,b,e){return t.$block[e]?"\n":b?b:""});return b.replace(a,
"").replace(/\u00a0/g," ").replace(/&nbsp;/g," ")},getContentTxt:function(){return this.body[n.ie?"innerText":"textContent"].replace(RegExp(f.fillChar,"g"),"").replace(/\u00a0/g," ")},setContent:function(a,b,c){this.fireEvent("beforesetcontent",a);a=UE.htmlparser(a);this.filterInputRule(a);a=a.toHtml();this.body.innerHTML=(b?this.body.innerHTML:"")+a;if("p"==this.options.enterTag)if(b=this.body.firstChild,!b||1==b.nodeType&&(t.$cdata[b.tagName]||"DIV"==b.tagName&&b.getAttribute("cdata_tag")||f.isCustomeNode(b))&&
b===this.body.lastChild)this.body.innerHTML="<p>"+(n.ie?"&nbsp;":"<br/>")+"</p>"+this.body.innerHTML;else for(var d=this.document.createElement("p");b;){for(;b&&(3==b.nodeType||1==b.nodeType&&t.p[b.tagName]&&!t.$cdata[b.tagName]);)a=b.nextSibling,d.appendChild(b),b=a;if(d.firstChild)if(b)b.parentNode.insertBefore(d,b),d=this.document.createElement("p");else{this.body.appendChild(d);break}b=b.nextSibling}this.fireEvent("aftersetcontent");this.fireEvent("contentchange");!c&&this._selectionChange();
this._bakRange=this._bakIERange=null;var e;n.gecko&&(e=this.selection.getNative())&&e.removeAllRanges();this.options.autoSyncData&&this.form&&sa(this.form,this)},focus:function(a){try{var b=this.selection.getRange();a?b.setStartAtLast(this.body.lastChild).setCursor(!1,!0):b.select(!0);this.fireEvent("focus")}catch(c){}},_initEvents:function(){var a=this,b=a.document,c=a.window;a._proxyDomEvent=p.bind(a._proxyDomEvent,a);f.on(b,"click contextmenu mousedown keydown keyup keypress mouseup mouseover mouseout selectstart".split(" "),
a._proxyDomEvent);f.on(c,["focus","blur"],a._proxyDomEvent);f.on(b,["mouseup","keydown"],function(b){"keydown"==b.type&&(b.ctrlKey||b.metaKey||b.shiftKey||b.altKey)||2!=b.button&&a._selectionChange(250,b)});var d=0,b=n.ie?a.body:a.document,e;f.on(b,"dragstart",function(){d=1});f.on(b,n.webkit?"dragover":"drop",n.webkit?function(){clearTimeout(e);e=setTimeout(function(){if(!d){var b=a.selection.getRange();if(b&&(b=b.getCommonAncestor())&&a.serialize){var c=a.serialize,e=c.filter(c.transformInput(c.parseHTML(c.word(b.innerHTML))));
b.innerHTML=c.toHTML(e)}}d=0},200)}:function(a){d||(a.preventDefault?a.preventDefault():a.returnValue=!1);d=0})},_proxyDomEvent:function(a){return this.fireEvent(a.type.replace(/^on/,""),a)},_selectionChange:function(a,b){var c=this,d=!1,e,g;n.ie&&(9>n.version&&b&&"mouseup"==b.type)&&!this.selection.getRange().collapsed&&(d=!0,e=b.clientX,g=b.clientY);clearTimeout(Bb);Bb=setTimeout(function(){if(c.selection.getNative()){var a;if(d&&"None"==c.selection.getNative().type){a=c.document.body.createTextRange();
try{a.moveToPoint(e,g)}catch(f){a=null}}var l;a&&(l=c.selection.getIERange,c.selection.getIERange=function(){return a});c.selection.cache();l&&(c.selection.getIERange=l);c.selection._cachedRange&&c.selection._cachedStartElement&&(c.fireEvent("beforeselectionchange"),c.fireEvent("selectionchange",!!b),c.fireEvent("afterselectionchange"),c.selection.clear())}},a||50)},_callCmdFn:function(a,b){var c=b[0].toLowerCase(),d;d=(c=this.commands[c]||UE.commands[c])&&c[a];if((!c||!d)&&"queryCommandState"==a)return 0;
if(d)return d.apply(this,b)},execCommand:function(a){a=a.toLowerCase();var b,c=this.commands[a]||UE.commands[a];if(!c||!c.execCommand)return null;!c.notNeedUndo&&!this.__hasEnterExecCommand?(this.__hasEnterExecCommand=!0,-1!=this.queryCommandState.apply(this,arguments)&&(this.fireEvent("beforeexeccommand",a),b=this._callCmdFn("execCommand",arguments),!this._ignoreContentChange&&this.fireEvent("contentchange"),this.fireEvent("afterexeccommand",a)),this.__hasEnterExecCommand=!1):(b=this._callCmdFn("execCommand",
arguments),!this._ignoreContentChange&&this.fireEvent("contentchange"));!this._ignoreContentChange&&this._selectionChange();return b},queryCommandState:function(a){return this._callCmdFn("queryCommandState",arguments)},queryCommandValue:function(a){return this._callCmdFn("queryCommandValue",arguments)},hasContents:function(a){if(a)for(var b=0,c;c=a[b++];)if(0<this.document.getElementsByTagName(c).length)return!0;if(!f.isEmptyBlock(this.body))return!0;a=["div"];for(b=0;c=a[b++];){c=f.getElementsByTagName(this.document,
c);for(var d=0,e;e=c[d++];)if(f.isCustomeNode(e))return!0}return!1},reset:function(){this.fireEvent("reset")},setEnabled:function(){var a;if("false"==this.body.contentEditable){this.body.contentEditable=!0;a=this.selection.getRange();try{a.moveToBookmark(this.lastBk),delete this.lastBk}catch(b){a.setStartAtFirst(this.body).collapse(!0)}a.select(!0);this.bkqueryCommandState&&(this.queryCommandState=this.bkqueryCommandState,delete this.bkqueryCommandState);this.fireEvent("selectionchange")}},enable:function(){return this.setEnabled()},
setDisabled:function(a){var b=this;a=a?p.isArray(a)?a:[a]:[];"true"==b.body.contentEditable&&(b.lastBk||(b.lastBk=b.selection.getRange().createBookmark(!0)),b.body.contentEditable=!1,b.bkqueryCommandState=b.queryCommandState,b.queryCommandState=function(c){return-1!=p.indexOf(a,c)?b.bkqueryCommandState.apply(b,arguments):-1},b.fireEvent("selectionchange"))},disable:function(a){return this.setDisabled(a)},_setDefaultContent:function(a){this.body.innerHTML='<p id="initContent">'+a+"</p>";this.addListener("firstBeforeExecCommand focus",
Db)},setShow:function(){var a=this.selection.getRange();if("none"==this.container.style.display){try{a.moveToBookmark(this.lastBk),delete this.lastBk}catch(b){a.setStartAtFirst(this.body).collapse(!0)}setTimeout(function(){a.select(!0)},100);this.container.style.display=""}},show:function(){return this.setShow()},setHide:function(){this.lastBk||(this.lastBk=this.selection.getRange().createBookmark(!0));this.container.style.display="none"},hide:function(){return this.setHide()},getLang:function(a){var b=
UE.I18N[this.options.lang];if(!b)throw Error("not import language file");a=(a||"").split(".");for(var c=0,d;(d=a[c++])&&!(b=b[d],!b););return b},getContentLength:function(a,b){var c=this.getContent(!1,!1,!0).length;if(a){b=(b||[]).concat(["hr","img","iframe"]);for(var c=this.getContentTxt().replace(/[\t\r\n]+/g,"").length,d=0,e;e=b[d++];)c+=this.document.getElementsByTagName(e).length}return c},addInputRule:function(a){this.inputRules.push(a)},filterInputRule:function(a){for(var b=0,c;c=this.inputRules[b++];)c.call(this,
a)},addOutputRule:function(a){this.outputRules.push(a)},filterOutputRule:function(a){for(var b=0,c;c=this.outputRules[b++];)c.call(this,a)}};p.inherits(Cb,Da);var Lc=UE,Eb=function(a){var b=[],c;for(c in a)"method"==c||"timeout"==c||"async"==c||"function"==(typeof a[c]).toLowerCase()||"object"==(typeof a[c]).toLowerCase()||b.push(encodeURIComponent(c)+"="+encodeURIComponent(a[c]));return b.join("&")},Ka="XMLHttpRequest()";try{new ActiveXObject("Msxml2.XMLHTTP"),Ka="ActiveXObject('Msxml2.XMLHTTP')"}catch(Td){try{new ActiveXObject("Microsoft.XMLHTTP"),
Ka="ActiveXObject('Microsoft.XMLHTTP')"}catch(Ud){}}var Mc=new Function("return new "+Ka);Lc.ajax={request:function(a,b){var c=Mc(),d=!1,e={method:"POST",timeout:5E3,async:!0,data:{},onsuccess:function(){},onerror:function(){}};"object"===typeof a&&(b=a,a=b.url);if(c&&a){var g=b?p.extend(e,b):e,e=Eb(g);p.isEmptyObject(g.data)||(e+=(e?"&":"")+Eb(g.data));var f=setTimeout(function(){4!=c.readyState&&(d=!0,c.abort(),clearTimeout(f))},g.timeout),j=g.method.toUpperCase(),l=a+(-1==a.indexOf("?")?"?":"&")+
("POST"==j?"":e+"&noCache="+ +new Date);c.open(j,l,g.async);c.onreadystatechange=function(){if(4==c.readyState)if(!d&&200==c.status)g.onsuccess(c);else g.onerror(c)};"POST"==j?(c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send(e)):c.send(null)}}};var aa=function(a){return a=a.replace(/[\d.]+\w+/g,function(a){return p.transUnitToPx(a)})};UE.filterWord=function(a){return/(class="?Mso|style="[^"]*\bmso\-|w:WordDocument|<v:)/ig.test(a)?a.replace(/[\t\r\n]+/g,"").replace(/\x3c!--[\s\S]*?--\x3e/ig,
"").replace(/<v:shape [^>]*>[\s\S]*?.<\/v:shape>/gi,function(a){if(n.opera)return"";try{var c=a.match(/width:([ \d.]*p[tx])/i)[1],d=a.match(/height:([ \d.]*p[tx])/i)[1],e=a.match(/src=\s*"([^"]*)"/i)[1];return'<img width="'+aa(c)+'" height="'+aa(d)+'" src="'+e+'" />'}catch(g){return""}}).replace(/<\/?div[^>]*>/g,"").replace(/v:\w+=(["']?)[^'"]+\1/g,"").replace(/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|xml|meta|link|style|\w+:\w+)(?=[\s\/>]))[^>]*>/gi,"").replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi,
"<p><strong>$1</strong></p>").replace(/\s+(class|lang|align)\s*=\s*(['"]?)([\w-]+)\2/ig,function(a,c,d,e){return"class"==c&&"MsoListParagraph"==e?a:""}).replace(/<(font|span)[^>]*>\s*<\/\1>/gi,"").replace(/(<[a-z][^>]*)\sstyle=(["'])([^\2]*?)\2/gi,function(a,c,d,e){a=[];e=e.replace(/^\s+|\s+$/,"").replace(/&#39;/g,"'").replace(/&quot;/gi,"'").split(/;\s*/g);d=0;for(var g;g=e[d];d++){var f,j=g.split(":");if(2==j.length&&(g=j[0].toLowerCase(),f=j[1].toLowerCase(),!(/^(background)\w*/.test(g)&&0==f.replace(/(initial|\s)/g,
"").length||/^(margin)\w*/.test(g)&&/^0\w+$/.test(f)))){switch(g){case "mso-padding-alt":case "mso-padding-top-alt":case "mso-padding-right-alt":case "mso-padding-bottom-alt":case "mso-padding-left-alt":case "mso-margin-alt":case "mso-margin-top-alt":case "mso-margin-right-alt":case "mso-margin-bottom-alt":case "mso-margin-left-alt":case "mso-height":case "mso-width":case "mso-vertical-align-alt":/<table/.test(c)||(a[d]=g.replace(/^mso-|-alt$/g,"")+":"+aa(f));continue;case "horiz-align":a[d]="text-align:"+
f;continue;case "vert-align":a[d]="vertical-align:"+f;continue;case "font-color":case "mso-foreground":a[d]="color:"+f;continue;case "mso-background":case "mso-highlight":a[d]="background:"+f;continue;case "mso-default-height":a[d]="min-height:"+aa(f);continue;case "mso-default-width":a[d]="min-width:"+aa(f);continue;case "mso-padding-between-alt":a[d]="border-collapse:separate;border-spacing:"+aa(f);continue;case "text-line-through":if("single"==f||"double"==f)a[d]="text-decoration:line-through";
continue;case "mso-zero-height":"yes"==f&&(a[d]="display:none");continue;case "margin":if(!/[1-9]/.test(f))continue}/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?:decor|trans)|top-bar|version|vnd|word-break)/.test(g)||/text\-indent|padding|margin/.test(g)&&/\-[\d.]+/.test(f)||(a[d]=g+":"+j[1])}}return c+(a.length?' style="'+a.join(";").replace(/;{2,}/g,";")+'"':"")}).replace(/[\d.]+(cm|pt)/g,function(a){return p.transUnitToPx(a)}):
a};var ta=function(a,b,c){a.push(Nc);return b+(c?1:-1)},ua=function(a,b){for(var c=0;c<b;c++)a.push(Oc)},La=function(a,b,c,d){switch(a.type){case "root":for(var e=0,g;g=a.children[e++];)c&&("element"==g.type&&!t.$inlineWithA[g.tagName]&&1<e)&&(ta(b,d,!0),ua(b,d)),La(g,b,c,d);break;case "text":b.push("pre"==a.parentNode.tagName?a.data:a.data.replace(/[ ]{2}/g," &nbsp;"));break;case "element":g="";if(a.attrs){g=[];var f=a.attrs;for(e in f)g.push(e+(void 0!==f[e]?'="'+p.unhtml(f[e])+'"':""));g=g.join(" ")}b.push("<"+
a.tagName+(g?" "+g:"")+(t.$empty[a.tagName]?"/":"")+">");c&&(!t.$inlineWithA[a.tagName]&&"pre"!=a.tagName)&&(a.children&&a.children.length)&&(d=ta(b,d,!0),ua(b,d));if(a.children&&a.children.length)for(e=0;g=a.children[e++];)c&&("element"==g.type&&!t.$inlineWithA[g.tagName]&&1<e)&&(ta(b,d),ua(b,d)),La(g,b,c,d);t.$empty[a.tagName]||(c&&(!t.$inlineWithA[a.tagName]&&"pre"!=a.tagName)&&(a.children&&a.children.length)&&(d=ta(b,d),ua(b,d)),b.push("</"+a.tagName+">"));break;case "comment":b.push("\x3c!--"+
a.data+"--\x3e")}return b},Fb=function(a,b){var c;if("element"==a.type&&a.getAttr("id")==b)return a;if(a.children&&a.children.length)for(var d=0;c=a.children[d++];)if(c=Fb(c,b))return c},Gb=function(a,b,c){"element"==a.type&&a.tagName==b&&c.push(a);if(a.children&&a.children.length)for(var d=0,e;e=a.children[d++];)Gb(e,b,c)},Hb=function(a,b){if(a.children&&a.children.length)for(var c=0,d;d=a.children[c];)Hb(d,b),d.parentNode&&(d.children&&d.children.length&&b(d),d.parentNode&&c++);else b(a)},ga=UE.uNode=
function(a){this.type=a.type;this.data=a.data;this.tagName=a.tagName;this.parentNode=a.parentNode;this.attrs=a.attrs||{};this.children=a.children},Oc="    ",Nc="\n";ga.createElement=function(a){return/[<>]/.test(a)?UE.htmlparser(a).children[0]:new ga({type:"element",children:[],tagName:a})};ga.createText=function(a){return new UE.uNode({type:"text",data:p.unhtml(a||"")})};ga.prototype={toHtml:function(a){var b=[];La(this,b,a,0);return b.join("")},innerHTML:function(a){if("element"!=this.type||t.$empty[this.tagName])return this;
if(p.isString(a)){if(this.children)for(var b=0,c;c=this.children[b++];)c.parentNode=null;this.children=[];a=UE.htmlparser(a);for(b=0;c=a.children[b++];)this.children.push(c),c.parentNode=this;return this}a=new UE.uNode({type:"root",children:this.children});return a.toHtml()},innerText:function(a){if("element"!=this.type||t.$empty[this.tagName])return this;if(a){if(this.children)for(var b=0,c;c=this.children[b++];)c.parentNode=null;this.children=[];this.appendChild(ga.createText(a));return this}return this.toHtml().replace(/<[^>]+>/g,
"")},getData:function(){return"element"==this.type?"":this.data},firstChild:function(){return this.children?this.children[0]:null},lastChild:function(){return this.children?this.children[this.children.length-1]:null},previousSibling:function(){for(var a=this.parentNode,b=0,c;c=a.children[b];b++)if(c===this)return 0==b?null:a.children[b-1]},nextSibling:function(){for(var a=this.parentNode,b=0,c;c=a.children[b++];)if(c===this)return a.children[b]},replaceChild:function(a,b){if(this.children){a.parentNode&&
a.parentNode.removeChild(a);for(var c=0,d;d=this.children[c];c++)if(d===b)return this.children.splice(c,1,a),b.parentNode=null,a.parentNode=this,a}},appendChild:function(a){if("root"==this.type||"element"==this.type&&!t.$empty[this.tagName]){this.children||(this.children=[]);a.parentNode&&a.parentNode.removeChild(a);for(var b=0,c;c=this.children[b];b++)if(c===a){this.children.splice(b,1);break}this.children.push(a);a.parentNode=this;return a}},insertBefore:function(a,b){if(this.children){a.parentNode&&
a.parentNode.removeChild(a);for(var c=0,d;d=this.children[c];c++)if(d===b)return this.children.splice(c,0,a),a.parentNode=this,a}},insertAfter:function(a,b){if(this.children){a.parentNode&&a.parentNode.removeChild(a);for(var c=0,d;d=this.children[c];c++)if(d===b)return this.children.splice(c+1,0,a),a.parentNode=this,a}},removeChild:function(a,b){if(this.children)for(var c=0,d;d=this.children[c];c++)if(d===a){this.children.splice(c,1);d.parentNode=null;if(b&&d.children&&d.children.length)for(var e=
0,f;f=d.children[e];e++)this.children.splice(c+e,0,f),f.parentNode=this;return d}},getAttr:function(a){return this.attrs&&this.attrs[a.toLowerCase()]},setAttr:function(a,b){if(a)if(this.attrs||(this.attrs={}),p.isObject(a))for(var c in a)a[c]?this.attrs[c.toLowerCase()]=a[c]:delete this.attrs[c];else b?this.attrs[a.toLowerCase()]=b:delete this.attrs[a];else delete this.attrs},getIndex:function(){for(var a=this.parentNode,b=0,c;c=a.children[b];b++)if(c===this)return b;return-1},getNodeById:function(a){var b;
if(this.children&&this.children.length)for(var c=0;b=this.children[c++];)if(b=Fb(b,a))return b},getNodesByTagName:function(a){a=p.trim(a).replace(/[ ]{2,}/g," ").split(" ");var b=[],c=this;p.each(a,function(a){if(c.children&&c.children.length)for(var e=0,f;f=c.children[e++];)Gb(f,a,b)});return b},getStyle:function(a){var b=this.getAttr("style");return!b?"":(a=b.match(RegExp(a+":([^;]+)","i")))&&a[0]?a[1]:""},setStyle:function(a,b){function c(a,b){d=d.replace(RegExp(a+":([^;]+;?)","gi"),"");b&&(d=
a+":"+p.unhtml(b)+";"+d)}var d=this.getAttr("style");d||(d="");if(p.isObject(a))for(var e in a)c(e,a[e]);else c(a,b);this.setAttr("style",d)},traversal:function(a){this.children&&this.children.length&&Hb(this,a);return this}};UE.htmlparser=function(a,b){function c(a,b){if(k[a.tagName]){var c=j.createElement(k[a.tagName]);a.appendChild(c);c.appendChild(j.createText(b))}else a.appendChild(j.createText(b))}function d(a,b,c){var e;if(e=l[b]){for(var f=a,h;"root"!=f.type;){if(p.isArray(e)?-1!=p.indexOf(e,
f.tagName):e==f.tagName){a=f;h=!0;break}f=f.parentNode}h||(a=d(a,p.isArray(e)?e[0]:e))}e=new j({parentNode:a,type:"element",tagName:b.toLowerCase(),children:t.$empty[b]?null:[]});if(c){for(f={};h=g.exec(c);)f[h[1].toLowerCase()]=p.unhtml(h[2]||h[3]||h[4]);e.attrs=f}a.children.push(e);return t.$empty[b]?a:e}var e=/<(?:(?:\/([^>]+)>)|(?:!--([\S|\s]*?)--\x3e)|(?:([^\s\/>]+)\s*((?:(?:"[^"]*")|(?:'[^']*')|[^"'<>])*)\/?>))/g,g=/([\w\-:.]+)(?:(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+)))|(?=\s|$))/g,
h={b:1,code:1,i:1,u:1,strike:1,s:1,tt:1,strong:1,q:1,samp:1,em:1,span:1,sub:1,img:1,sup:1,font:1,big:1,small:1,iframe:1,a:1,br:1,pre:1};a=a.replace(RegExp(f.fillChar,"g"),"");b||(a=a.replace(RegExp("[\\r\\t\\n"+(b?"":" ")+"]*</?(\\w+)\\s*(?:[^>]*)>[\\r\\t\\n"+(b?"":" ")+"]*","g"),function(a,c){return c&&h[c.toLowerCase()]?a.replace(/(^[\n\r]+)|([\n\r]+$)/g,""):a.replace(RegExp("^[\\r\\n"+(b?"":" ")+"]+"),"").replace(RegExp("[\\r\\n"+(b?"":" ")+"]+$"),"")}));for(var j=UE.uNode,l={td:"tr",tr:["tbody",
"thead","tfoot"],tbody:"table",th:"tr",thead:"table",tfoot:"table",caption:"table",li:["ul","ol"],dt:"dl",dd:"dl",option:"select"},k={ol:"li",ul:"li"},m,n=0,q=0,E=new j({type:"root",children:[]}),s=E;m=e.exec(a);){n=m.index;try{if(n>q&&c(s,a.slice(q,n)),m[3])s=d(s,m[3].toLowerCase(),m[4]);else if(m[1]){if("root"!=s.type){for(n=s;"element"==s.type&&s.tagName!=m[1].toLowerCase();)if(s=s.parentNode,"root"==s.type)throw s=n,"break";s=s.parentNode}}else m[2]&&s.children.push(new j({type:"comment",data:m[2],
parentNode:s}))}catch(A){}q=e.lastIndex}q<a.length&&c(s,a.slice(q));return E};var ha=function(a,b){switch(a.type){case "element":var c;if(c=b[a.tagName])if("-"===c)a.parentNode.removeChild(a);else if(p.isFunction(c)){var d=a.parentNode,e=a.getIndex();c(a);if(a.parentNode){if(a.children)for(c=0;e=a.children[c];)ha(e,b),e.parentNode&&c++}else for(c=e;e=d.children[c];)ha(e,b),e.parentNode&&c++}else{if((c=c.$)&&a.attrs){var e={},f;for(d in c){f=a.getAttr(d);if("style"==d&&p.isArray(c[d])){var h=[];p.each(c[d],
function(b){var c;(c=a.getStyle(b))&&h.push(b+":"+c)});f=h.join(";")}f&&(e[d]=f)}a.attrs=e}if(a.children)for(c=0;e=a.children[c];)ha(e,b),e.parentNode&&c++}else if(t.$cdata[a.tagName])a.parentNode.removeChild(a);else{d=a.parentNode;e=a.getIndex();a.parentNode.removeChild(a,!0);for(c=e;e=d.children[c];)ha(e,b),e.parentNode&&c++}break;case "comment":a.parentNode.removeChild(a)}};UE.filterNode=function(a,b){if(p.isEmptyObject(b))return a;var c;(c=b["-"])&&p.each(c.split(" "),function(a){b[a]="-"});c=
0;for(var d;d=a.children[c];)ha(d,b),d.parentNode&&c++;return a};UE.plugins.defaultfilter=function(){var a=this;a.addInputRule(function(b){var c;b.traversal(function(b){if("element"==b.type){if(!t.$cdata[b.tagName]&&a.options.autoClearEmptyNode&&t.$inline[b.tagName]&&!t.$empty[b.tagName]&&(!b.attrs||p.isEmptyObject(b.attrs))){b.firstChild()?"span"==b.tagName&&(!b.attrs||p.isEmptyObject(b.attrs))&&b.parentNode.removeChild(b,!0):b.parentNode.removeChild(b);return}switch(b.tagName){case "style":case "script":b.setAttr({cdata_tag:b.tagName,
cdata_data:encodeURIComponent(b.innerText()||"")});b.tagName="div";b.removeChild(b.firstChild());break;case "a":(c=b.getAttr("href"))&&b.setAttr("_href",c);break;case "img":if((c=b.getAttr("src"))&&/^data:/.test(c)){b.parentNode.removeChild(b);break}b.setAttr("_src",b.getAttr("src"));break;case "span":if(n.webkit&&(c=b.getStyle("white-space"))&&/nowrap|normal/.test(c))b.setStyle("white-space",""),a.options.autoClearEmptyNode&&p.isEmptyObject(b.attrs)&&b.parentNode.removeChild(b,!0);break;case "p":if(c=
b.getAttr("align"))b.setAttr("align"),b.setStyle("text-align",c);var e=b.getAttr("style");e&&(e=e.replace(/(margin|padding)[^;]+/g,""),b.setAttr("style",e));b.firstChild()||b.innerHTML(UE.browser.ie?"&nbsp;":"<br>");break;case "div":if(b.getAttr("cdata_tag"))break;if((c=b.getAttr("class"))&&/^line number\d+/.test(c))break;for(var f=UE.uNode.createElement("p");e=b.firstChild();)"text"==e.type||!UE.dom.dtd.$block[e.tagName]?f.appendChild(e):f.firstChild()?(b.parentNode.insertBefore(f,b),f=UE.uNode.createElement("p")):
b.parentNode.insertBefore(e,b);f.firstChild()&&b.parentNode.insertBefore(f,b);b.parentNode.removeChild(b);break;case "dl":b.tagName="ul";break;case "dt":case "dd":b.tagName="li";break;case "li":e=b.getAttr("class");(!e||!/list\-/.test(e))&&b.setAttr();e=b.getNodesByTagName("ol ul");UE.utils.each(e,function(a){b.parentNode.insertAfter(a,b)});break;case "td":case "th":case "caption":if(!b.children||!b.children.length)b.appendChild(n.ie?UE.uNode.createText(" "):UE.uNode.createElement("br"))}}"comment"==
b.type&&b.parentNode.removeChild(b)})});a.addOutputRule(function(b){var c;b.traversal(function(b){if("element"==b.type)if(a.options.autoClearEmptyNode&&t.$inline[b.tagName]&&!t.$empty[b.tagName]&&(!b.attrs||p.isEmptyObject(b.attrs)))b.firstChild()?"span"==b.tagName&&(!b.attrs||p.isEmptyObject(b.attrs))&&b.parentNode.removeChild(b,!0):b.parentNode.removeChild(b);else switch(b.tagName){case "div":if(c=b.getAttr("cdata_tag"))b.tagName=c,b.appendChild(UE.uNode.createText(b.getAttr("cdata_data"))),b.setAttr({cdata_tag:"",
cdata_data:""});break;case "a":(c=b.getAttr("_href"))&&b.setAttr({href:c,_href:""});break;case "img":(c=b.getAttr("_src"))&&b.setAttr({src:b.getAttr("_src"),_src:""})}})})};UE.commands.inserthtml={execCommand:function(a,b,c){var d=this,e;if(b&&!0!==d.fireEvent("beforeinserthtml",b)){e=d.selection.getRange();a=e.document.createElement("div");a.style.display="inline";c||(b=UE.htmlparser(b),d.options.filterRules&&UE.filterNode(b,d.options.filterRules),d.filterInputRule(b),b=b.toHtml());a.innerHTML=p.trim(b);
if(!e.collapsed){b=e.startContainer;f.isFillChar(b)&&e.setStartBefore(b);b=e.endContainer;f.isFillChar(b)&&e.setEndAfter(b);e.txtToElmBoundary();e.endContainer&&1==e.endContainer.nodeType&&(b=e.endContainer.childNodes[e.endOffset])&&f.isBr(b)&&e.setEndAfter(b);if(0==e.startOffset&&(b=e.startContainer,f.isBoundaryNode(b,"firstChild")&&(b=e.endContainer,e.endOffset==(3==b.nodeType?b.nodeValue.length:b.childNodes.length)&&f.isBoundaryNode(b,"lastChild"))))d.body.innerHTML="<p>"+(n.ie?"":"<br/>")+"</p>",
e.setStart(d.body.firstChild,0).collapse(!0);!e.collapsed&&e.deleteContents();if(1==e.startContainer.nodeType){b=e.startContainer.childNodes[e.startOffset];var g;if(b&&f.isBlockElm(b)&&(g=b.previousSibling)&&f.isBlockElm(g)){for(e.setEnd(g,g.childNodes.length).collapse();b.firstChild;)g.appendChild(b.firstChild);f.remove(b)}}}var h,j;c=0;var l;e.inFillChar()&&(b=e.startContainer,f.isFillChar(b)?(e.setStartBefore(b).collapse(!0),f.remove(b)):f.isFillChar(b,!0)&&(b.nodeValue=b.nodeValue.replace(fa,
""),e.startOffset--,e.collapsed&&e.collapse(!0)));var k=f.findParentByTagName(e.startContainer,"li",!0);if(k){for(var m;b=a.firstChild;){for(;b&&(3==b.nodeType||!f.isBlockElm(b)||"HR"==b.tagName);)m=b.nextSibling,e.insertNode(b).collapse(),h=b,b=m;if(b)if(/^(ol|ul)$/i.test(b.tagName)){for(;b.firstChild;)h=b.firstChild,f.insertAfter(k,b.firstChild),k=k.nextSibling;f.remove(b)}else m=b.nextSibling,g=d.document.createElement("li"),f.insertAfter(k,g),g.appendChild(b),h=b,b=m,k=g}k=f.findParentByTagName(e.startContainer,
"li",!0);f.isEmptyBlock(k)&&f.remove(k);h&&e.setStartAfter(h).collapse(!0).select(!0)}else{for(;b=a.firstChild;){if(c){for(h=d.document.createElement("p");b&&(3==b.nodeType||!t.$block[b.tagName]);)l=b.nextSibling,h.appendChild(b),b=l;h.firstChild&&(b=h)}e.insertNode(b);l=b.nextSibling;if(!c&&b.nodeType==f.NODE_ELEMENT&&f.isBlockElm(b)&&(h=f.findParent(b,function(a){return f.isBlockElm(a)}))&&"body"!=h.tagName.toLowerCase()&&!(t[h.tagName][b.nodeName]&&b.parentNode===h)){if(t[h.tagName][b.nodeName])for(j=
b.parentNode;j!==h;)g=j,j=j.parentNode;else g=h;f.breakParent(b,g||j);g=b.previousSibling;f.trimWhiteTextNode(g);g.childNodes.length||f.remove(g);!n.ie&&((m=b.nextSibling)&&f.isBlockElm(m)&&m.lastChild&&!f.isBr(m.lastChild))&&m.appendChild(d.document.createElement("br"));c=1}m=b.nextSibling;if(!a.firstChild&&m&&f.isBlockElm(m)){e.setStart(m,0).collapse(!0);break}e.setEndAfter(b).collapse()}b=e.startContainer;l&&f.isBr(l)&&f.remove(l);if(f.isBlockElm(b)&&f.isEmptyNode(b))if(l=b.nextSibling)f.remove(b),
1==l.nodeType&&t.$block[l.tagName]&&e.setStart(l,0).collapse(!0).shrinkBoundary();else try{b.innerHTML=n.ie?f.fillChar:"<br/>"}catch(C){e.setStartBefore(b),f.remove(b)}try{e.select(!0)}catch(q){}}setTimeout(function(){e=d.selection.getRange();e.scrollToView(d.autoHeightEnabled,d.autoHeightEnabled?f.getXY(d.iframe).y:0);d.fireEvent("afterinserthtml")},200)}}};UE.plugins.autotypeset=function(){function a(a,b){if(!a||3==a.nodeType)return 0;if(f.isBr(a))return 1;if(a&&a.parentNode&&j[a.tagName.toLowerCase()])return l&&
l.contains(a)||a.getAttribute("pagebreak")?0:b?!f.isEmptyBlock(a):f.isEmptyBlock(a,RegExp("[\\s"+f.fillChar+"]","g"))}function b(a){a.style.cssText||(f.removeAttributes(a,["style"]),"span"==a.tagName.toLowerCase()&&f.hasNoAttributes(a)&&f.remove(a,!0))}function c(c,d){var j;if(d){if(!e.pasteFilter)return;j=this.document.createElement("div");j.innerHTML=d.html}else j=this.document.body;for(var p=f.getElementsByTagName(j,"*"),E=0,s;s=p[E++];)if(!0!==this.fireEvent("excludeNodeinautotype",s)){e.clearFontSize&&
s.style.fontSize&&(f.removeStyle(s,"font-size"),b(s));e.clearFontFamily&&s.style.fontFamily&&(f.removeStyle(s,"font-family"),b(s));if(a(s)){if(e.mergeEmptyline)for(var A=s.nextSibling,n,Q=f.isBr(s);a(A);){n=A;A=n.nextSibling;if(Q&&(!A||A&&!f.isBr(A)))break;f.remove(n)}if(e.removeEmptyline&&f.inDoc(s,j)&&!h[s.parentNode.tagName.toLowerCase()]){if(f.isBr(s)&&(A=s.nextSibling)&&!f.isBr(A))continue;f.remove(s);continue}}a(s,!0)&&"SPAN"!=s.tagName&&(e.indent&&(s.style.textIndent=e.indentValue),e.textAlign&&
(s.style.textAlign=e.textAlign));if(e.removeClass&&s.className&&!g[s.className.toLowerCase()]){if(l&&l.contains(s))continue;f.removeAttributes(s,["class"])}if(e.imageBlockLine&&"img"==s.tagName.toLowerCase()&&!s.getAttribute("emotion"))if(d)switch(Q=s,e.imageBlockLine){case "left":case "right":case "none":for(var A=Q.parentNode,q;t.$inline[A.tagName]||"A"==A.tagName;)A=A.parentNode;n=A;if("P"==n.tagName&&"center"==f.getStyle(n,"text-align")&&!f.isBody(n)&&1==f.getChildCount(n,function(a){return!f.isBr(a)&&
!f.isWhitespace(a)}))if(q=n.previousSibling,A=n.nextSibling,q&&A&&1==q.nodeType&&1==A.nodeType&&q.tagName==A.tagName&&f.isBlockElm(q)){for(q.appendChild(n.firstChild);A.firstChild;)q.appendChild(A.firstChild);f.remove(n);f.remove(A)}else f.setStyle(n,"text-align","");f.setStyle(Q,"float",e.imageBlockLine);break;case "center":if("center"!=this.queryCommandValue("imagefloat")){A=Q.parentNode;f.setStyle(Q,"float","none");for(n=Q;A&&1==f.getChildCount(A,function(a){return!f.isBr(a)&&!f.isWhitespace(a)})&&
(t.$inline[A.tagName]||"A"==A.tagName);)n=A,A=A.parentNode;A=this.document.createElement("p");f.setAttributes(A,{style:"text-align:center"});n.parentNode.insertBefore(A,n);A.appendChild(n);f.setStyle(n,"float","")}}else this.selection.getRange().selectNode(s).select(),this.execCommand("imagefloat",e.imageBlockLine);e.removeEmptyNode&&e.removeTagNames[s.tagName.toLowerCase()]&&(f.hasNoAttributes(s)&&f.isEmptyBlock(s))&&f.remove(s)}d&&(d.html=j.innerHTML)}this.setOpt({autotypeset:{mergeEmptyline:!0,
removeClass:!0,removeEmptyline:!1,textAlign:"left",imageBlockLine:"center",pasteFilter:!1,clearFontSize:!1,clearFontFamily:!1,removeEmptyNode:!1,removeTagNames:p.extend({div:1},t.$removeEmpty),indent:!1,indentValue:"2em"}});var d=this,e=d.options.autotypeset,g={selectTdClass:1,pagebreak:1,anchorclass:1},h={li:1},j={div:1,p:1,blockquote:1,center:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,span:1},l;e&&(e.pasteFilter&&d.addListener("beforepaste",c),d.commands.autotypeset={execCommand:function(){d.removeListener("beforepaste",
c);e.pasteFilter&&d.addListener("beforepaste",c);c.call(d)}})};UE.plugins.autosubmit=function(){this.commands.autosubmit={execCommand:function(){var a=f.findParentByTagName(this.iframe,"form",!1);a&&!1!==this.fireEvent("beforesubmit")&&(this.sync(),a.submit())}};this.addshortcutkey({autosubmit:"ctrl+13"})};UE.plugins.background=function(){var a=this;a.addListener("getAllHtml",function(b,c){var d=this.body,e=f.getComputedStyle(d,"background-image"),g="",g=0<e.indexOf(a.options.imagePath)?e.substring(e.indexOf(a.options.imagePath),
e.length-1).replace(/"|\(|\)/ig,""):"none"!=e?e.replace(/url\("?|"?\)/ig,""):"",e='<style type="text/css">body{',d={"background-color":f.getComputedStyle(d,"background-color")||"#ffffff","background-image":g?"url("+g+")":"","background-repeat":f.getComputedStyle(d,"background-repeat")||"","background-position":n.ie?f.getComputedStyle(d,"background-position-x")+" "+f.getComputedStyle(d,"background-position-y"):f.getComputedStyle(d,"background-position"),height:f.getComputedStyle(d,"height")},h;for(h in d)d.hasOwnProperty(h)&&
(e+=h+":"+d[h]+";");c.push(e+"}</style> ")})};UE.commands.imagefloat={execCommand:function(a,b){var c=this.selection.getRange();if(!c.collapsed){var d=c.getClosedNode();if(d&&"IMG"==d.tagName)switch(b){case "left":case "right":case "none":for(var e=d.parentNode,g,h;t.$inline[e.tagName]||"A"==e.tagName;)e=e.parentNode;g=e;if("P"==g.tagName&&"center"==f.getStyle(g,"text-align")){if(!f.isBody(g)&&1==f.getChildCount(g,function(a){return!f.isBr(a)&&!f.isWhitespace(a)}))if(e=g.previousSibling,h=g.nextSibling,
e&&h&&1==e.nodeType&&1==h.nodeType&&e.tagName==h.tagName&&f.isBlockElm(e)){for(e.appendChild(g.firstChild);h.firstChild;)e.appendChild(h.firstChild);f.remove(g);f.remove(h)}else f.setStyle(g,"text-align","");c.selectNode(d).select()}f.setStyle(d,"float","none"==b?"":b);"none"==b&&f.removeAttributes(d,"align");break;case "center":if("center"!=this.queryCommandValue("imagefloat")){e=d.parentNode;f.setStyle(d,"float","");f.removeAttributes(d,"align");for(g=d;e&&1==f.getChildCount(e,function(a){return!f.isBr(a)&&
!f.isWhitespace(a)})&&(t.$inline[e.tagName]||"A"==e.tagName);)g=e,e=e.parentNode;c.setStartBefore(g).setCursor(!1);e=this.document.createElement("div");e.appendChild(g);f.setStyle(g,"float","");this.execCommand("insertHtml",'<p id="_img_parent_tmp" style="text-align:center">'+e.innerHTML+"</p>");g=this.document.getElementById("_img_parent_tmp");g.removeAttribute("id");g=g.firstChild;c.selectNode(g).select();(h=g.parentNode.nextSibling)&&f.isEmptyNode(h)&&f.remove(h)}}}},queryCommandValue:function(){var a=
this.selection.getRange(),b;return a.collapsed?"none":(a=a.getClosedNode())&&1==a.nodeType&&"IMG"==a.tagName?(b=a.getAttribute("align")||f.getComputedStyle(a,"float"),"none"==b&&(b="center"==f.getComputedStyle(a.parentNode,"text-align")?"center":b),{left:1,right:1,center:1}[b]?b:"none"):"none"},queryCommandState:function(){var a=this.selection.getRange();return a.collapsed?-1:(a=a.getClosedNode())&&1==a.nodeType&&"IMG"==a.tagName?0:-1}};UE.commands.insertimage={execCommand:function(a,b){b=p.isArray(b)?
b:[b];if(b.length){var c=this.selection.getRange(),d=c.getClosedNode();if(d&&/img/i.test(d.tagName)&&"edui-faked-video"!=d.className&&!d.getAttribute("word_img")){var e=b.shift(),g=e.floatStyle;delete e.floatStyle;f.setAttributes(d,e);this.execCommand("imagefloat",g);0<b.length&&(c.setStartAfter(d).setCursor(!1,!0),this.execCommand("insertimage",b))}else{c=[];d="";e=b[0];if(1==b.length)d='<img src="'+e.src+'" '+(e._src?' _src="'+e._src+'" ':"")+(e.width?'width="'+e.width+'" ':"")+(e.height?' height="'+
e.height+'" ':"")+("left"==e.floatStyle||"right"==e.floatStyle?' style="float:'+e.floatStyle+';"':"")+(e.title&&""!=e.title?' title="'+e.title+'"':"")+(e.border&&"0"!=e.border?' border="'+e.border+'"':"")+(e.alt&&""!=e.alt?' alt="'+e.alt+'"':"")+(e.hspace&&"0"!=e.hspace?' hspace = "'+e.hspace+'"':"")+(e.vspace&&"0"!=e.vspace?' vspace = "'+e.vspace+'"':"")+"/>","center"==e.floatStyle&&(d='<p style="text-align: center">'+d+"</p>"),c.push(d);else for(g=0;e=b[g++];)d="<p "+("center"==e.floatStyle?'style="text-align: center" ':
"")+'><img src="'+e.src+'" '+(e.width?'width="'+e.width+'" ':"")+(e._src?' _src="'+e._src+'" ':"")+(e.height?' height="'+e.height+'" ':"")+' style="'+(e.floatStyle&&"center"!=e.floatStyle?"float:"+e.floatStyle+";":"")+(e.border||"")+'" '+(e.title?' title="'+e.title+'"':"")+" /></p>",c.push(d);this.execCommand("insertHtml",c.join(""))}}}};UE.plugins.justify=function(){var a=f.isBlockElm,b={left:1,right:1,center:1,justify:1};UE.commands.justify={execCommand:function(b,d){var e=this.selection.getRange(),
g;e.collapsed&&(g=this.document.createTextNode("p"),e.insertNode(g));var h=e.createBookmark(),j=function(a){return 1==a.nodeType?"br"!=a.tagName.toLowerCase()&&!f.isBookmarkNode(a):!f.isWhitespace(a)};e.enlarge(!0);for(var l=e.createBookmark(),k=f.getNextDomNode(l.start,!1,j),m=e.cloneRange(),n;k&&!(f.getPosition(k,l.end)&f.POSITION_FOLLOWING);)if(3==k.nodeType||!a(k)){for(m.setStartBefore(k);k&&k!==l.end&&!a(k);)n=k,k=f.getNextDomNode(k,!1,null,function(b){return!a(b)});m.setEndAfter(n);k=m.getCommonAncestor();
if(!f.isBody(k)&&a(k))f.setStyles(k,p.isString(d)?{"text-align":d}:d);else{k=e.document.createElement("p");f.setStyles(k,p.isString(d)?{"text-align":d}:d);var q=m.extractContents();k.appendChild(q);m.insertNode(k)}k=f.getNextDomNode(k,!1,j)}else k=f.getNextDomNode(k,!0,j);e.moveToBookmark(l).moveToBookmark(h);g&&(e.setStartBefore(g).collapse(!0),f.remove(g));e.select();return!0},queryCommandValue:function(){var a=this.selection.getStart(),a=f.getComputedStyle(a,"text-align");return b[a]?a:"left"},
queryCommandState:function(){var a=this.selection.getStart();return a&&f.findParentByTagName(a,["td","th","caption"],!0)?-1:0}}};UE.plugins.font=function(){function a(a){var b=a.collapsed,c=a.createBookmark();if(b)for(b=c.start.parentNode;t.$inline[b.tagName];)b=b.parentNode;else b=f.getCommonAncestor(c.start,c.end);p.each(f.getElementsByTagName(b,"span"),function(a){if(a.parentNode&&!f.isBookmarkNode(a))if(/^\s*border\s*:\s*none;\s*/i.test(a.style.cssText))f.remove(a,!0);else{/border/i.test(a.style.cssText)&&
("SPAN"==a.parentNode.tagName&&/border/i.test(a.parentNode.style.cssText))&&(a.style.cssText=a.style.cssText.replace(/border[^:]*:[^;]+;?/gi,""));for(var b=a.nextSibling;b&&1==b.nodeType&&"SPAN"==b.tagName;){f.isBookmarkNode(b)?a.appendChild(b):b.style.cssText==a.style.cssText&&(f.moveChild(b,a),f.remove(b));if(a.nextSibling===b)break;b=a.nextSibling}}});a.moveToBookmark(c)}var b={forecolor:"color",backcolor:"background-color",fontsize:"font-size",fontfamily:"font-family",underline:"text-decoration",
strikethrough:"text-decoration",fontborder:"border"},c={underline:1,strikethrough:1,fontborder:1};this.setOpt({fontfamily:[{name:"songti",val:"\u5b8b\u4f53,SimSun"},{name:"yahei",val:"\u5fae\u8f6f\u96c5\u9ed1,Microsoft YaHei"},{name:"kaiti",val:"\u6977\u4f53,\u6977\u4f53_GB2312, SimKai"},{name:"heiti",val:"\u9ed1\u4f53, SimHei"},{name:"lishu",val:"\u96b6\u4e66, SimLi"},{name:"andaleMono",val:"andale mono"},{name:"arial",val:"arial, helvetica,sans-serif"},{name:"arialBlack",val:"arial black,avant garde"},
{name:"comicSansMs",val:"comic sans ms"},{name:"impact",val:"impact,chicago"},{name:"timesNewRoman",val:"times new roman"}],fontsize:[10,11,12,14,16,18,20,24,36]});this.addInputRule(function(a){p.each(a.getNodesByTagName("u s del font"),function(a){if("font"==a.tagName){var b=[],c;for(c in a.attrs)switch(c){case "size":b.push("font-size:"+a.attrs[c]+"px");break;case "color":b.push("color:"+a.attrs[c]);break;case "face":b.push("font-family:"+a.attrs[c]);break;case "style":b.push(a.attrs[c])}a.attrs=
{style:b.join(";")}}else b="u"==a.tagName?"underline":"line-through",a.attrs={style:(a.getAttr("style")||"")+"text-decoration:"+b+";"};a.tagName="span"})});for(var d in b)(function(b,d){UE.commands[b]={execCommand:function(h,j){j=j||(this.queryCommandState(h)?"none":"underline"==h?"underline":"fontborder"==h?"1px solid #000":"line-through");var l=this,k=this.selection.getRange(),m;if("default"==j)k.collapsed&&(m=l.document.createTextNode("font"),k.insertNode(m).select()),l.execCommand("removeFormat",
"span,a",d),m&&(k.setStartBefore(m).setCursor(),f.remove(m));else if(k.collapsed){var p=f.findParentByTagName(k.startContainer,"span",!0);m=l.document.createTextNode("font");if(p&&!p.children.length&&!p[n.ie?"innerText":"textContent"].replace(fa,"").length)k.insertNode(m),c[b]&&(k.selectNode(m).select(),l.execCommand("removeFormat","span,a",d,null),p=f.findParentByTagName(m,"span",!0),k.setStartBefore(m)),p&&(p.style.cssText+=";"+d+":"+j),k.collapse(!0).select();else{k.insertNode(m);k.selectNode(m).select();
p=k.document.createElement("span");if(c[b]){if(f.findParentByTagName(m,"a",!0)){k.setStartBefore(m).setCursor();f.remove(m);return}l.execCommand("removeFormat","span,a",d)}p.style.cssText=d+":"+j;m.parentNode.insertBefore(p,m);if(!n.ie||n.ie&&9==n.version)for(var q=p.parentNode;!f.isBlockElm(q);)"SPAN"==q.tagName&&(p.style.cssText=q.style.cssText+";"+p.style.cssText),q=q.parentNode;Cc?setTimeout(function(){k.setStart(p,0).collapse(!0);a(k,l);k.select()}):(k.setStart(p,0).collapse(!0),a(k,l),k.select())}f.remove(m)}else c[b]&&
l.queryCommandValue(b)&&l.execCommand("removeFormat","span,a",d),k=l.selection.getRange(),k.applyInlineStyle("span",{style:d+":"+j}),a(k,l),k.select();return!0},queryCommandValue:function(a){var b=this.selection.getStart();if("underline"==a||"strikethrough"==a){for(var c=b;c&&!f.isBlockElm(c)&&!f.isBody(c);){if(1==c.nodeType&&(a=f.getComputedStyle(c,d),"none"!=a))return a;c=c.parentNode}return"none"}if("fontborder"==a){for(a=b;a&&t.$inline[a.tagName];){if((c=f.getComputedStyle(a,"border"))&&/1px/.test(c)&&
/solid/.test(c))return c;a=a.parentNode}return""}return f.getComputedStyle(b,d)},queryCommandState:function(a){if(!c[a])return 0;var b=this.queryCommandValue(a);return"fontborder"==a?/1px/.test(b)&&/solid/.test(b):b==("underline"==a?"underline":"line-through")}}})(d,b[d])};UE.plugins.link=function(){function a(a){var c=a.startContainer,d=a.endContainer;(c=f.findParentByTagName(c,"a",!0))&&a.setStartBefore(c);(d=f.findParentByTagName(d,"a",!0))&&a.setEndAfter(d)}UE.commands.unlink={execCommand:function(){var b=
this.selection.getRange(),c;if(!b.collapsed||f.findParentByTagName(b.startContainer,"a",!0))c=b.createBookmark(),a(b),b.removeInlineStyle("a").moveToBookmark(c).select()},queryCommandState:function(){return!this.highlight&&this.queryCommandValue("link")?0:-1}};UE.commands.link={execCommand:function(b,c){var d;c._href&&(c._href=p.unhtml(c._href,/[<">]/g));c.href&&(c.href=p.unhtml(c.href,/[<">]/g));c.textValue&&(c.textValue=p.unhtml(c.textValue,/[<">]/g));var e=d=this.selection.getRange(),g=e.cloneRange(),
h=this.queryCommandValue("link");a(e=e.adjustmentBoundary());var j=e.startContainer;if(1==j.nodeType&&h&&(j=j.childNodes[e.startOffset])&&1==j.nodeType&&"A"==j.tagName&&/^(?:https?|ftp|file)\s*:\s*\/\//.test(j[n.ie?"innerText":"textContent"]))j[n.ie?"innerText":"textContent"]=p.html(c.textValue||c.href);if(!g.collapsed||h)e.removeInlineStyle("a"),g=e.cloneRange();if(g.collapsed){var h=e.document.createElement("a"),l="";c.textValue?(l=p.html(c.textValue),delete c.textValue):l=p.html(c.href);f.setAttributes(h,
c);(j=f.findParentByTagName(g.startContainer,"a",!0))&&f.isInNodeEndBoundary(g,j)&&e.setStartAfter(j).collapse(!0);h[n.ie?"innerText":"textContent"]=l;e.insertNode(h).selectNode(h)}else e.applyInlineStyle("a",c);d.collapse().select(!0)},queryCommandValue:function(){var a=this.selection.getRange(),c;if(a.collapsed){if(c=a.startContainer,(c=1==c.nodeType?c:c.parentNode)&&(c=f.findParentByTagName(c,"a",!0))&&!f.isInNodeEndBoundary(a,c))return c}else{a.shrinkBoundary();var d=3==a.startContainer.nodeType||
!a.startContainer.childNodes[a.startOffset]?a.startContainer:a.startContainer.childNodes[a.startOffset],e=3==a.endContainer.nodeType||0==a.endOffset?a.endContainer:a.endContainer.childNodes[a.endOffset-1],a=a.getCommonAncestor();c=f.findParentByTagName(a,"a",!0);if(!c&&1==a.nodeType)for(var a=a.getElementsByTagName("a"),g,h,j=0,l;l=a[j++];)if(g=f.getPosition(l,d),h=f.getPosition(l,e),(g&f.POSITION_FOLLOWING||g&f.POSITION_CONTAINS)&&(h&f.POSITION_PRECEDING||h&f.POSITION_CONTAINS)){c=l;break}return c}},
queryCommandState:function(){var a=this.selection.getRange().getClosedNode();return a&&"edui-faked-video"==a.className?-1:0}}};UE.plugins.insertframe=function(){var a=this;a.addListener("selectionchange",function(){a._iframe&&delete a._iframe})};UE.commands.scrawl={queryCommandState:function(){return n.ie&&8>=n.version?-1:0}};UE.plugins.removeformat=function(){this.setOpt({removeFormatTags:"b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var",removeFormatAttributes:"class,style,lang,width,height,align,hspace,valign"});
this.commands.removeformat={execCommand:function(a,b,c,d,e){function g(a){if(3==a.nodeType||"span"!=a.tagName.toLowerCase())return 0;if(n.ie){var b=a.attributes;if(b.length){a=0;for(var c=b.length;a<c;a++)if(b[a].specified)return 0;return 1}}return!a.attributes.length}b=RegExp("^(?:"+(b||this.options.removeFormatTags).replace(/,/g,"|")+")$","i");var h=c?[]:(d||this.options.removeFormatAttributes).split(",");d=new R.Range(this.document);var j,l=function(a){return 1==a.nodeType};a=d=this.selection.getRange();
var k=a.createBookmark();a.collapsed&&a.enlarge(!0);e||((e=f.findParentByTagName(a.startContainer,"a",!0))&&a.setStartBefore(e),(e=f.findParentByTagName(a.endContainer,"a",!0))&&a.setEndAfter(e));e=a.createBookmark();for(m=e.start;(j=m.parentNode)&&!f.isBlockElm(j);)f.breakParent(m,j),f.clearEmptySibling(m);if(e.end){for(m=e.end;(j=m.parentNode)&&!f.isBlockElm(j);)f.breakParent(m,j),f.clearEmptySibling(m);for(j=f.getNextDomNode(e.start,!1,l);j&&j!=e.end;)m=f.getNextDomNode(j,!0,l),!t.$empty[j.tagName.toLowerCase()]&&
!f.isBookmarkNode(j)&&(b.test(j.tagName)?c?(f.removeStyle(j,c),g(j)&&"text-decoration"!=c&&f.remove(j,!0)):f.remove(j,!0):!t.$tableContent[j.tagName]&&!t.$list[j.tagName]&&(f.removeAttributes(j,h),g(j)&&f.remove(j,!0))),j=m}c=e.start.parentNode;f.isBlockElm(c)&&(!t.$tableContent[c.tagName]&&!t.$list[c.tagName])&&f.removeAttributes(c,h);c=e.end.parentNode;e.end&&(f.isBlockElm(c)&&!t.$tableContent[c.tagName]&&!t.$list[c.tagName])&&f.removeAttributes(c,h);a.moveToBookmark(e).moveToBookmark(k);var m=
a.startContainer;for(b=a.collapsed;1==m.nodeType&&f.isEmptyNode(m)&&t.$removeEmpty[m.tagName];)c=m.parentNode,a.setStartBefore(m),a.startContainer===a.endContainer&&a.endOffset--,f.remove(m),m=c;if(!b)for(m=a.endContainer;1==m.nodeType&&f.isEmptyNode(m)&&t.$removeEmpty[m.tagName];)c=m.parentNode,a.setEndBefore(m),f.remove(m),m=c;d.select()}}};UE.plugins.blockquote=function(){this.commands.blockquote={execCommand:function(a,b){var c=this.selection.getRange(),d=f.filterNodeList(this.selection.getStartElementPath(),
"blockquote"),e=t.blockquote,g=c.createBookmark();if(d){var e=c.startContainer,e=f.isBlockElm(e)?e:f.findParent(e,function(a){return f.isBlockElm(a)}),h=c.endContainer,h=f.isBlockElm(h)?h:f.findParent(h,function(a){return f.isBlockElm(a)}),e=f.findParentByTagName(e,"li",!0)||e,h=f.findParentByTagName(h,"li",!0)||h;"LI"==e.tagName||"TD"==e.tagName||e===d||f.isBody(e)?f.remove(d,!0):f.breakParent(e,d);e!==h&&(d=f.findParentByTagName(h,"blockquote"))&&("LI"==h.tagName||"TD"==h.tagName||f.isBody(h)?d.parentNode&&
f.remove(d,!0):f.breakParent(h,d));for(var j=f.getElementsByTagName(this.document,"blockquote"),d=0,l;l=j[d++];)l.childNodes.length?f.getPosition(l,e)&f.POSITION_FOLLOWING&&f.getPosition(l,h)&f.POSITION_PRECEDING&&f.remove(l,!0):f.remove(l)}else{d=c.cloneRange();j=h=1==d.startContainer.nodeType?d.startContainer:d.startContainer.parentNode;for(l=1;;){if(f.isBody(h)){j!==h?c.collapsed?(d.selectNode(j),l=0):d.setStartBefore(j):d.setStart(h,0);break}if(!e[h.tagName]){c.collapsed?d.selectNode(j):d.setStartBefore(j);
break}j=h;h=h.parentNode}if(l)for(j=h=h=1==d.endContainer.nodeType?d.endContainer:d.endContainer.parentNode;;){if(f.isBody(h)){j!==h?d.setEndAfter(j):d.setEnd(h,h.childNodes.length);break}if(!e[h.tagName]){d.setEndAfter(j);break}j=h;h=h.parentNode}h=c.document.createElement("blockquote");f.setAttributes(h,b);h.appendChild(d.extractContents());d.insertNode(h);e=f.getElementsByTagName(h,"blockquote");for(d=0;h=e[d++];)h.parentNode&&f.remove(h,!0)}c.moveToBookmark(g).select()},queryCommandState:function(){return f.filterNodeList(this.selection.getStartElementPath(),
"blockquote")?1:0}}};UE.commands.touppercase=UE.commands.tolowercase={execCommand:function(a){var b=this.selection.getRange();if(b.collapsed)return b;for(var c=b.createBookmark(),d=c.end,e=function(a){return!f.isBr(a)&&!f.isWhitespace(a)},g=f.getNextDomNode(c.start,!1,e);g&&f.getPosition(g,d)&f.POSITION_PRECEDING&&!(3==g.nodeType&&(g.nodeValue=g.nodeValue["touppercase"==a?"toUpperCase":"toLowerCase"]()),g=f.getNextDomNode(g,!0,e),g===d););b.moveToBookmark(c).select()}};UE.commands.indent={execCommand:function(){var a=
this.queryCommandState("indent")?"0em":this.options.indentValue||"2em";this.execCommand("Paragraph","p",{style:"text-indent:"+a})},queryCommandState:function(){var a=f.filterNodeList(this.selection.getStartElementPath(),"p h1 h2 h3 h4 h5 h6");return a&&a.style.textIndent&&parseInt(a.style.textIndent)?1:0}};UE.commands.print={execCommand:function(){this.window.print()},notNeedUndo:1};UE.commands.preview={execCommand:function(){var a=window.open("","_blank","").document;a.open();a.write('<html><head><script src="'+
this.options.UEDITOR_HOME_URL+"editor.parse.js\">\x3c/script><script>setTimeout(function(){uParse('div',{    'highlightJsUrl':'"+this.options.UEDITOR_HOME_URL+"third-party/SyntaxHighlighter/shCore.js',    'highlightCssUrl':'"+this.options.UEDITOR_HOME_URL+"third-party/SyntaxHighlighter/shCoreDefault.css'})},300)\x3c/script></head><body><div>"+this.getContent(null,null,!0)+"</div></body></html>");a.close()},notNeedUndo:1};UE.plugins.selectall=function(){this.commands.selectall={execCommand:function(){var a=
this.body,b=this.selection.getRange();b.selectNodeContents(a);f.isEmptyBlock(a)&&(n.opera&&(a.firstChild&&1==a.firstChild.nodeType)&&b.setStartAtFirst(a.firstChild),b.collapse(!0));b.select(!0)},notNeedUndo:1};this.addshortcutkey({selectAll:"ctrl+65"})};UE.plugins.paragraph=function(){var a=f.isBlockElm,b=["TD","LI","PRE"];this.setOpt("paragraph",{p:"",h1:"",h2:"",h3:"",h4:"",h5:"",h6:""});this.commands.paragraph={execCommand:function(c,d,e,g){c=this.selection.getRange();if(c.collapsed){var h=this.document.createTextNode("p");
c.insertNode(h);if(n.ie){var j=h.previousSibling;j&&f.isWhitespace(j)&&f.remove(j);(j=h.nextSibling)&&f.isWhitespace(j)&&f.remove(j)}}var j=c.createBookmark(),l=function(a){return 1==a.nodeType?"br"!=a.tagName.toLowerCase()&&!f.isBookmarkNode(a):!f.isWhitespace(a)},k;c.enlarge(!0);var m=c.createBookmark();k=f.getNextDomNode(m.start,!1,l);for(var q=c.cloneRange(),v;k&&!(f.getPosition(k,m.end)&f.POSITION_FOLLOWING);)if(3==k.nodeType||!a(k)){for(q.setStartBefore(k);k&&k!==m.end&&!a(k);)v=k,k=f.getNextDomNode(k,
!1,null,function(b){return!a(b)});q.setEndAfter(v);k=c.document.createElement(d);e&&(f.setAttributes(k,e),g&&("customstyle"==g&&e.style)&&(k.style.cssText=e.style));k.appendChild(q.extractContents());f.isEmptyNode(k)&&f.fillChar(c.document,k);q.insertNode(k);var E=k.parentNode;a(E)&&(!f.isBody(k.parentNode)&&-1==p.indexOf(b,E.tagName))&&(g&&"customstyle"==g||(E.getAttribute("dir")&&k.setAttribute("dir",E.getAttribute("dir")),E.style.cssText&&(k.style.cssText=E.style.cssText+";"+k.style.cssText),E.style.textAlign&&
!k.style.textAlign&&(k.style.textAlign=E.style.textAlign),E.style.textIndent&&!k.style.textIndent&&(k.style.textIndent=E.style.textIndent),E.style.padding&&!k.style.padding&&(k.style.padding=E.style.padding)),e&&/h\d/i.test(E.tagName)&&!/h\d/i.test(k.tagName)?(f.setAttributes(E,e),g&&("customstyle"==g&&e.style)&&(E.style.cssText=e.style),f.remove(k,!0),k=E):f.remove(k.parentNode,!0));k=-1!=p.indexOf(b,E.tagName)?E:k;k=f.getNextDomNode(k,!1,l)}else k=f.getNextDomNode(k,!0,l);c=c.moveToBookmark(m).moveToBookmark(j);
h&&(c.setStartBefore(h).collapse(!0),pN=h.parentNode,f.remove(h),f.isBlockElm(pN)&&f.isEmptyNode(pN)&&f.fillNode(this.document,pN));n.gecko&&c.collapsed&&1==c.startContainer.nodeType&&(e=c.startContainer.childNodes[c.startOffset])&&(1==e.nodeType&&e.tagName.toLowerCase()==d)&&c.setStart(e,0).collapse(!0);c.select();return!0},queryCommandValue:function(){var a=f.filterNodeList(this.selection.getStartElementPath(),"p h1 h2 h3 h4 h5 h6");return a?a.tagName.toLowerCase():""}}};var va=f.isBlockElm,Jb=
function(a){return f.filterNodeList(a.selection.getStartElementPath(),function(a){return a.getAttribute("dir")})};UE.commands.directionality={execCommand:function(a,b){var c=this.selection.getRange();if(c.collapsed){var d=this.document.createTextNode("d");c.insertNode(d)}var e,g=function(a){return 1==a.nodeType?!f.isBookmarkNode(a):!f.isWhitespace(a)};if((e=Jb(this))&&c.collapsed)e.setAttribute("dir",b);else{e=c.createBookmark();c.enlarge(!0);for(var h=c.createBookmark(),j=f.getNextDomNode(h.start,
!1,g),l=c.cloneRange(),k;j&&!(f.getPosition(j,h.end)&f.POSITION_FOLLOWING);)if(3==j.nodeType||!va(j)){for(l.setStartBefore(j);j&&j!==h.end&&!va(j);)k=j,j=f.getNextDomNode(j,!1,null,function(a){return!va(a)});l.setEndAfter(k);j=l.getCommonAncestor();if(!f.isBody(j)&&va(j))j.setAttribute("dir",b);else{j=c.document.createElement("p");j.setAttribute("dir",b);var m=l.extractContents();j.appendChild(m);l.insertNode(j)}j=f.getNextDomNode(j,!1,g)}else j=f.getNextDomNode(j,!0,g);c.moveToBookmark(h).moveToBookmark(e)}d&&
(c.setStartBefore(d).collapse(!0),f.remove(d));c.select();return!0},queryCommandValue:function(){var a=Jb(this);return a?a.getAttribute("dir"):"ltr"}};UE.plugins.horizontal=function(){this.commands.horizontal={execCommand:function(a){if(-1!==this.queryCommandState(a)){this.execCommand("insertHtml","<hr>");a=this.selection.getRange();var b=a.startContainer;if(1==b.nodeType&&!b.childNodes[a.startOffset]){var c;if((c=b.childNodes[a.startOffset-1])&&1==c.nodeType&&"HR"==c.tagName)"p"==this.options.enterTag?
(c=this.document.createElement("p"),a.insertNode(c),a.setStart(c,0).setCursor()):(c=this.document.createElement("br"),a.insertNode(c),a.setStartBefore(c).setCursor())}return!0}},queryCommandState:function(){return f.filterNodeList(this.selection.getStartElementPath(),"table")?-1:0}};this.addListener("delkeyup",function(){var a=this.selection.getRange();f.isBody(a.startContainer)&&(a=a.startContainer.childNodes[a.startOffset-1])&&"HR"==a.nodeName&&f.remove(a)})};UE.commands.time=UE.commands.date={execCommand:function(a){var b=
new Date;this.execCommand("insertHtml","time"==a?b.getHours()+":"+(10>b.getMinutes()?"0"+b.getMinutes():b.getMinutes())+":"+(10>b.getSeconds()?"0"+b.getSeconds():b.getSeconds()):b.getFullYear()+"-"+(10>b.getMonth()+1?"0"+(b.getMonth()+1):b.getMonth()+1)+"-"+(10>b.getDate()?"0"+b.getDate():b.getDate()))}};UE.plugins.rowspacing=function(){this.setOpt({rowspacingtop:["5","10","15","20","25"],rowspacingbottom:["5","10","15","20","25"]});this.commands.rowspacing={execCommand:function(a,b,c){this.execCommand("paragraph",
"p",{style:"margin-"+c+":"+b+"px"});return!0},queryCommandValue:function(a,b){var c=f.filterNodeList(this.selection.getStartElementPath(),function(a){return f.isBlockElm(a)});return c?(c=f.getComputedStyle(c,"margin-"+b).replace(/[^\d]/g,""),!c?0:c):0}}};UE.plugins.lineheight=function(){this.setOpt({lineheight:"1 1.5 1.75 2 3 4 5".split(" ")});this.commands.lineheight={execCommand:function(a,b){this.execCommand("paragraph","p",{style:"line-height:"+("1"==b?"normal":b+"em")});return!0},queryCommandValue:function(){var a=
f.filterNodeList(this.selection.getStartElementPath(),function(a){return f.isBlockElm(a)});if(a)return a=f.getComputedStyle(a,"line-height"),"normal"==a?1:a.replace(/[^\d.]*/ig,"")}}};UE.plugins.insertcode=function(){var a=this;a.ready(function(){p.cssRule("pre","pre{margin:.5em 0;padding:.4em .6em;border-radius:8px;background:#f8f8f8;line-height:1.5}",a.document)});a.setOpt("insertcode",{as3:"ActionScript3",bash:"Bash/Shell",cpp:"C/C++",css:"Css",cf:"CodeFunction","c#":"C#",delphi:"Delphi",diff:"Diff",
erlang:"Erlang",groovy:"Groovy",html:"Html",java:"Java",jfx:"JavaFx",js:"Javascript",pl:"Perl",php:"Php",plain:"Plain Text",ps:"PowerShell",python:"Python",ruby:"Ruby",scala:"Scala",sql:"Sql",vb:"Vb",xml:"Xml"});a.commands.insertcode={execCommand:function(a,c){var d=this.selection.getRange(),e=f.findParentByTagName(d.startContainer,"pre",!0);if(e)e.className="brush:"+c+";toolbar:false;";else{var g="";d.collapsed?g=n.ie?8<n.version?"":"&nbsp;":"<br/>":(e=d.extractContents(),d=this.document.createElement("div"),
d.appendChild(e),p.each(UE.filterNode(UE.htmlparser(d.innerHTML.replace(/[\r\t]/g,"")),this.options.filterTxtRules).children,function(a){n.ie&&8<n.version?("element"==a.type?"br"==a.tagName?g+="\n":t.$empty[a.tagName]||(p.each(a.children,function(b){"element"==b.type?"br"==b.tagName?g+="\n":t.$empty[a.tagName]||(g+=b.innerText()):g+=b.data}),/\n$/.test(g)||(g+="\n")):g+=a.data+"\n",!a.nextSibling()&&/\n$/.test(g)&&(g=g.replace(/\n$/,""))):n.ie?("element"==a.type?"br"==a.tagName?g+="<br>":t.$empty[a.tagName]||
(p.each(a.children,function(b){"element"==b.type?"br"==b.tagName?g+="<br>":t.$empty[a.tagName]||(g+=b.innerText()):g+=b.data}),/br>$/.test(g)||(g+="<br>")):g+=a.data+"<br>",!a.nextSibling()&&/<br>$/.test(g)&&(g=g.replace(/<br>$/,""))):(g+="element"==a.type?t.$empty[a.tagName]?"":a.innerText():a.data,!/br\/?\s*>$/.test(g)&&a.nextSibling()&&(g+="<br>"))}));this.execCommand("inserthtml",'<pre id="coder"class="brush:'+c+';toolbar:false">'+g+"</pre>",!0);e=this.document.getElementById("coder");f.removeAttributes(e,
"id");(d=e.previousSibling)&&f.isEmptyBlock(d)&&f.remove(d);d=this.selection.getRange();f.isEmptyBlock(e)?d.setStart(e,0).setCursor(!1,!0):d.selectNodeContents(e).select()}},queryCommandValue:function(){var a=this.selection.getStartElementPath(),c="";p.each(a,function(a){if("PRE"==a.nodeName)return c=(a=a.className.match(/brush:([^;]+)/))&&a[1]?a[1]:"",!1});return c}};a.addInputRule(function(a){p.each(a.getNodesByTagName("pre"),function(a){var b=a.getNodesByTagName("br");b.length?n.ie&&8<n.version&&
p.each(b,function(a){var b=UE.uNode.createText("\n");a.parentNode.insertBefore(b,a);a.parentNode.removeChild(a)}):n.ie&&8<n.version||(b=a.innerText().split(/\n/),a.innerHTML(""),p.each(b,function(b){b.length&&a.appendChild(UE.uNode.createText(b));a.appendChild(UE.uNode.createElement("br"))}))})});a.addOutputRule(function(a){p.each(a.getNodesByTagName("pre"),function(a){var b="";p.each(a.children,function(a){b="text"==a.type?b+a.data.replace(/[ ]/g,"&nbsp;"):b+"\n"});a.innerText(b.replace(/(&nbsp;|\n)+$/,
""))})});a.notNeedCodeQuery={help:1,undo:1,redo:1,source:1,print:1,searchreplace:1,fullscreen:1,preview:1,insertparagraph:1,elementpath:1,highlightcode:1,insertcode:1,inserthtml:1,selectall:1};a.queryCommandState=function(a){return!this.notNeedCodeQuery[a.toLowerCase()]&&this.selection&&this.queryCommandValue("insertcode")?-1:UE.Editor.prototype.queryCommandState.apply(this,arguments)};a.addListener("beforeenterkeydown",function(){var b=a.selection.getRange(),c=f.findParentByTagName(b.startContainer,
"pre",!0);if(c){a.fireEvent("saveScene");b.collapsed||b.deleteContents();if(n.ie)if(8<n.version){var c=a.document.createTextNode("\n"),d=b.startContainer;if(0==b.startOffset){if(d.previousSibling){b.insertNode(c);var e=a.document.createTextNode(" ");b.setStartAfter(c).insertNode(e).setStart(e,0).collapse(!0).select(!0)}}else b.insertNode(c).setStartAfter(c),e=a.document.createTextNode(" "),(d=b.startContainer.childNodes[b.startOffset])&&!/^\n/.test(d.nodeValue)&&b.setStartBefore(c),b.insertNode(e).setStart(e,
0).collapse(!0).select(!0)}else{c=a.document.createElement("br");b.insertNode(c);b.insertNode(a.document.createTextNode(f.fillChar));b.setStartAfter(c);for(c=c.previousSibling;c;)if(d=c,c=c.previousSibling,!c||"BR"==c.nodeName){c=d;break}if(c){for(d="";c&&"BR"!=c.nodeName&&RegExp("^[ "+f.fillChar+"]*$").test(c.nodeValue);)d+=c.nodeValue,c=c.nextSibling;"BR"!=c.nodeName&&(c=c.nodeValue.match(RegExp("^([ "+f.fillChar+"]+)")))&&c[1]&&(d+=c[1]);d=a.document.createTextNode(d);b.insertNode(d).setStartAfter(d)}b.collapse(!0).select()}else{c=
a.document.createElement("br");b.insertNode(c).setStartAfter(c).collapse(!0);c.nextSibling?b.setStartAfter(c):b.insertNode(c.cloneNode(!1));for(c=c.previousSibling;c;)if(d=c,c=c.previousSibling,!c||"BR"==c.nodeName){c=d;break}if(c){for(d="";c&&"BR"!=c.nodeName&&RegExp("^[\\s"+f.fillChar+"]*$").test(c.nodeValue);)d+=c.nodeValue,c=c.nextSibling;"BR"!=c.nodeName&&(c=c.nodeValue.match(RegExp("^([\\s"+f.fillChar+"]+)")))&&c[1]&&(d+=c[1]);d&&(d=a.document.createTextNode(d),b.insertNode(d).setStartAfter(d))}b.collapse(!0).select(!0)}a.fireEvent("saveScene");
return!0}});a.addListener("tabkeydown",function(b,c){var d=a.selection.getRange(),e=f.findParentByTagName(d.startContainer,"pre",!0);if(e){a.fireEvent("saveScene");if(!c.shiftKey)if(d.collapsed)e=a.document.createTextNode("    "),d.insertNode(e).setStartAfter(e).collapse(!0).select(!0);else{for(var g=d.createBookmark(),h=g.start.previousSibling;h;){if(e.firstChild===h&&!f.isBr(h)){e.insertBefore(a.document.createTextNode("    "),h);break}if(f.isBr(h)){e.insertBefore(a.document.createTextNode("    "),
h.nextSibling);break}h=h.previousSibling}var j=g.end,h=g.start.nextSibling;for(e.firstChild===g.start&&e.insertBefore(a.document.createTextNode("    "),h.nextSibling);h&&h!==j;){if(f.isBr(h)&&h.nextSibling){if(h.nextSibling===j)break;e.insertBefore(a.document.createTextNode("    "),h.nextSibling)}h=h.nextSibling}d.moveToBookmark(g).select()}a.fireEvent("saveScene");return!0}});a.addListener("beforeinserthtml",function(a,c){var d=this,e=d.selection.getRange();if(f.findParentByTagName(e.startContainer,
"pre",!0)){e.collapsed||e.deleteContents();var g="";if(n.ie&&8<n.version){p.each(UE.filterNode(UE.htmlparser(c),d.options.filterTxtRules).children,function(a){"element"==a.type?"br"==a.tagName?g+="\n":t.$empty[a.tagName]||(p.each(a.children,function(b){"element"==b.type?"br"==b.tagName?g+="\n":t.$empty[a.tagName]||(g+=b.innerText()):g+=b.data}),/\n$/.test(g)||(g+="\n")):g+=a.data+"\n";!a.nextSibling()&&/\n$/.test(g)&&(g=g.replace(/\n$/,""))});var h=d.document.createTextNode(p.html(g.replace(/&nbsp;/g,
" ")));e.insertNode(h).selectNode(h).select()}else{var j=d.document.createDocumentFragment();p.each(UE.filterNode(UE.htmlparser(c),d.options.filterTxtRules).children,function(a){"element"==a.type?"br"==a.tagName?j.appendChild(d.document.createElement("br")):t.$empty[a.tagName]||(p.each(a.children,function(b){"element"==b.type?"br"==b.tagName?j.appendChild(d.document.createElement("br")):t.$empty[a.tagName]||j.appendChild(d.document.createTextNode(p.html(b.innerText().replace(/&nbsp;/g," ")))):j.appendChild(d.document.createTextNode(p.html(b.data.replace(/&nbsp;/g,
" "))))}),"BR"!=j.lastChild.nodeName&&j.appendChild(d.document.createElement("br"))):j.appendChild(d.document.createTextNode(p.html(a.data.replace(/&nbsp;/g," "))));!a.nextSibling()&&"BR"==j.lastChild.nodeName&&j.removeChild(j.lastChild)});e.insertNode(j).select()}return!0}});a.addListener("keydown",function(a,c){if(40==(c.keyCode||c.which)){var d=this.selection.getRange(),e,g=d.startContainer;if(d.collapsed&&(e=f.findParentByTagName(d.startContainer,"pre",!0))&&!e.nextSibling){for(var h=e.lastChild;h&&
"BR"==h.nodeName;)h=h.previousSibling;if(h===g||d.startContainer===e&&d.startOffset==e.childNodes.length)this.execCommand("insertparagraph"),f.preventDefault(c)}}})};UE.commands.cleardoc={execCommand:function(){var a=this,b=a.options.enterTag,c=a.selection.getRange();"br"==b?(a.body.innerHTML="<br/>",c.setStart(a.body,0).setCursor()):(a.body.innerHTML="<p>"+(I?"":"<br/>")+"</p>",c.setStart(a.body.firstChild,0).setCursor(!1,!0));setTimeout(function(){a.fireEvent("clearDoc")},0)}};UE.plugins.anchor=
function(){var a=this;a.ready(function(){p.cssRule("anchor",".anchorclass{background: url('"+a.options.UEDITOR_HOME_URL+"themes/default/images/anchor.gif') no-repeat scroll left center transparent;border: 1px dotted #0000FF;cursor: auto;display: inline-block;height: 16px;width: 15px;}",a.document)});a.addOutputRule(function(a){p.each(a.getNodesByTagName("img"),function(a){var b;if(b=a.getAttr("anchorname"))a.tagName="a",a.setAttr({anchorname:"",name:b,"class":""})})});a.addInputRule(function(a){p.each(a.getNodesByTagName("a"),
function(a){a.getAttr("name")&&!a.getAttr("href")&&(a.tagName="img",a.setAttr({anchorname:a.getAttr("name"),"class":"anchorclass"}),a.setAttr("name"))})});a.commands.anchor={execCommand:function(a,c){var d=this.selection.getRange(),e=d.getClosedNode();e&&e.getAttribute("anchorname")?c?e.setAttribute("anchorname",c):(d.setStartBefore(e).setCursor(),f.remove(e)):c&&(e=this.document.createElement("img"),d.collapse(!0),f.setAttributes(e,{anchorname:c,"class":"anchorclass"}),d.insertNode(e).setStartAfter(e).setCursor(!1,
!0))}}};UE.plugins.wordcount=function(){var a=this;a.addListener("contentchange",function(){a.fireEvent("wordcount")});var b;a.addListener("ready",function(){var a=this;f.on(a.body,"keyup",function(d){(d.keyCode||d.which)in{16:1,18:1,20:1,37:1,38:1,39:1,40:1}||(clearTimeout(b),b=setTimeout(function(){a.fireEvent("wordcount")},200))})})};UE.plugins.pagebreak=function(){function a(a){if(f.isEmptyBlock(a)){for(var b=a.firstChild,d;b&&1==b.nodeType&&f.isEmptyBlock(b);)d=b,b=b.firstChild;!d&&(d=a);f.fillNode(c.document,
d)}}function b(a){return a&&1==a.nodeType&&"HR"==a.tagName&&"pagebreak"==a.className}var c=this,d=["td"];c.setOpt("pageBreakTag","_ueditor_page_break_tag_");c.ready(function(){p.cssRule("pagebreak",".pagebreak{display:block;clear:both !important;cursor:default !important;width: 100% !important;margin:0;}",c.document)});c.addInputRule(function(a){a.traversal(function(a){if("text"==a.type&&a.data==c.options.pageBreakTag){var b=UE.uNode.createElement('<hr class="pagebreak" noshade="noshade" size="5" style="-webkit-user-select: none;">');
a.parentNode.insertBefore(b,a);a.parentNode.removeChild(a)}})});c.addOutputRule(function(a){p.each(a.getNodesByTagName("hr"),function(a){if("pagebreak"==a.getAttr("class")){var b=UE.uNode.createText(c.options.pageBreakTag);a.parentNode.insertBefore(b,a);a.parentNode.removeChild(a)}})});c.commands.pagebreak={execCommand:function(){var e=c.selection.getRange(),g=c.document.createElement("hr");f.setAttributes(g,{"class":"pagebreak",noshade:"noshade",size:"5"});f.unSelectable(g);var h=f.findParentByTagName(e.startContainer,
d,!0),j=[];if(h)switch(h.tagName){case "TD":h=h.parentNode,h.previousSibling?(h.parentNode.insertBefore(g,h),j=f.findParents(g)):(e=f.findParentByTagName(h,"table"),e.parentNode.insertBefore(g,e),j=f.findParents(g,!0)),h=j[1],g!==h&&f.breakParent(g,h),c.fireEvent("afteradjusttable",c.document)}else{if(!e.collapsed){e.deleteContents();for(h=e.startContainer;!f.isBody(h)&&f.isBlockElm(h)&&f.isEmptyNode(h);)e.setStartBefore(h).collapse(!0),f.remove(h),h=e.startContainer}e.insertNode(g);for(h=g.parentNode;!f.isBody(h);)f.breakParent(g,
h),(h=g.nextSibling)&&f.isEmptyBlock(h)&&f.remove(h),h=g.parentNode;h=g.nextSibling;j=g.previousSibling;b(j)?f.remove(j):j&&a(j);h?(b(h)?f.remove(h):a(h),e.setEndAfter(g).collapse(!1)):(h=c.document.createElement("p"),g.parentNode.appendChild(h),f.fillNode(c.document,h),e.setStart(h,0).collapse(!0));e.select(!0)}}}};UE.plugins.wordimage=function(){var a=this,b;a.addInputRule(function(b){p.each(b.getNodesByTagName("img"),function(b){var c=b.attrs,f=128>parseInt(c.width)||43>parseInt(c.height),h=a.options,
j=h.UEDITOR_HOME_URL+"themes/default/images/spacer.gif";c._src&&-1!==c._src.indexOf("file:///")&&b.setAttr({width:c.width,height:c.height,alt:c.alt,word_img:c._src,src:j,_src:j,style:"background:url("+(f?h.themePath+h.theme+"/images/word.gif":h.langPath+h.lang+"/images/localimage.png")+") no-repeat center center;border:1px solid #ddd"})})});a.commands.wordimage={execCommand:function(){b=f.getElementsByTagName(a.document.body,"img");for(var c=[],d=0,e;e=b[d++];)(e=e.getAttribute("word_img"))&&c.push(e);
b.length&&(this.word_img=c)},queryCommandState:function(){b=f.getElementsByTagName(a.document.body,"img");for(var c=0,d;d=b[c++];)if(d.getAttribute("word_img"))return 1;return-1}}};UE.plugins.dragdrop=function(){var a=this;a.ready(function(){f.on(this.body,"dragend",function(){var b=a.selection.getRange(),c=b.getClosedNode()||a.selection.getStart();if(c&&"IMG"==c.tagName){for(var d=c.previousSibling,e;e=c.nextSibling;)if(1==e.nodeType&&"SPAN"==e.tagName&&!e.firstChild)f.remove(e);else break;if((d&&
1==d.nodeType&&!f.isEmptyBlock(d)||!d)&&(!e||e&&!f.isEmptyBlock(e)))d&&"P"==d.tagName&&!f.isEmptyBlock(d)?(d.appendChild(c),f.moveChild(e,d),f.remove(e)):e&&("P"==e.tagName&&!f.isEmptyBlock(e))&&e.insertBefore(c,e.firstChild),d&&("P"==d.tagName&&f.isEmptyBlock(d))&&f.remove(d),e&&("P"==e.tagName&&f.isEmptyBlock(e))&&f.remove(e),b.selectNode(c).select(),a.fireEvent("saveScene")}})});a.addListener("keyup",function(b,c){if(13==(c.keyCode||c.which)){var d=a.selection.getRange(),e;(e=f.findParentByTagName(d.startContainer,
"p",!0))&&"center"==f.getComputedStyle(e,"text-align")&&f.removeStyle(e,"text-align")}})};UE.plugins.undo=function(){function a(a,b){if(a.length!=b.length)return 0;for(var c=0,d=a.length;c<d;c++)if(a[c]!=b[c])return 0;return 1}function b(){this.undoManger.save()}var c,d=this.options.maxUndoCount||20,e=this.options.maxInputCount||20,g=RegExp(f.fillChar+"|</hr>","gi"),h={ol:1,ul:1,table:1,tbody:1,tr:1,body:1},j=this.options.autoClearEmptyNode;this.undoManger=new function(){this.list=[];this.index=0;
this.hasRedo=this.hasUndo=!1;this.undo=function(){if(this.hasUndo)if(!this.list[this.index-1]&&1==this.list.length)this.reset();else{for(;this.list[this.index].content==this.list[this.index-1].content;)if(this.index--,0==this.index)return this.restore(0);this.restore(--this.index)}};this.redo=function(){if(this.hasRedo){for(;this.list[this.index].content==this.list[this.index+1].content;)if(this.index++,this.index==this.list.length-1)return this.restore(this.index);this.restore(++this.index)}};this.restore=
function(){var a=this.editor,b=this.list[this.index],c=UE.htmlparser(b.content.replace(g,""));a.options.autoClearEmptyNode=!1;a.filterInputRule(c);a.options.autoClearEmptyNode=j;a.document.body.innerHTML=c.toHtml();a.fireEvent("afterscencerestore");n.ie&&p.each(f.getElementsByTagName(a.document,"td th caption p"),function(b){f.isEmptyNode(b)&&f.fillNode(a.document,b)});try{var d=(new R.Range(a.document)).moveToAddress(b.address);d.select(h[d.startContainer.nodeName.toLowerCase()])}catch(e){}this.update();
this.clearKey();a.fireEvent("reset",!0)};this.getScene=function(){var a=this.editor,b=a.selection.getRange().createAddress(!1,!0);a.fireEvent("beforegetscene");var c=UE.htmlparser(a.body.innerHTML,!0);a.options.autoClearEmptyNode=!1;a.filterOutputRule(c);a.options.autoClearEmptyNode=j;c=c.toHtml();n.ie&&(c=c.replace(/>&nbsp;</g,"><").replace(/\s*</g,"<").replace(/>\s*/g,">"));a.fireEvent("aftergetscene");return{address:b,content:c}};this.save=function(b,e){clearTimeout(c);var f=this.getScene(e),g=
this.list[this.index],h;if(h=g)if(h=g.content==f.content)b?g=1:(g=g.address,h=f.address,g=g.collapsed!=h.collapsed?0:!a(g.startAddress,h.startAddress)||!a(g.endAddress,h.endAddress)?0:1),h=g;h||(this.list=this.list.slice(0,this.index+1),this.list.push(f),this.list.length>d&&this.list.shift(),this.index=this.list.length-1,this.clearKey(),this.update())};this.update=function(){this.hasRedo=!!this.list[this.index+1];this.hasUndo=!!this.list[this.index-1]};this.reset=function(){this.list=[];this.index=
0;this.hasRedo=this.hasUndo=!1;this.clearKey()};this.clearKey=function(){k=0}};this.undoManger.editor=this;this.addListener("saveScene",function(){var a=Array.prototype.splice.call(arguments,1);this.undoManger.save.apply(this.undoManger,a)});this.addListener("beforeexeccommand",b);this.addListener("afterexeccommand",b);this.addListener("reset",function(a,b){b||this.undoManger.reset()});this.commands.redo=this.commands.undo={execCommand:function(a){this.undoManger[a]()},queryCommandState:function(a){return this.undoManger["has"+
("undo"==a.toLowerCase()?"Undo":"Redo")]?0:-1},notNeedUndo:1};var l={16:1,17:1,18:1,37:1,38:1,39:1,40:1},k=0,m=!1;this.addListener("ready",function(){f.on(this.body,"compositionstart",function(){m=!0});f.on(this.body,"compositionend",function(){m=!1})});this.addshortcutkey({Undo:"ctrl+90",Redo:"ctrl+89"});var q=!0;this.addListener("keydown",function(a,b){var d=this;if(!l[b.keyCode||b.which]&&(!b.ctrlKey&&!b.metaKey&&!b.shiftKey&&!b.altKey)&&!m)if(d.selection.getRange().collapsed){0==d.undoManger.list.length&&
d.undoManger.save(!0);clearTimeout(c);var f=function(a){a.selection.getRange().collapsed&&a.fireEvent("contentchange");a.undoManger.save(!1,!0);a.fireEvent("selectionchange")};c=setTimeout(function(){if(m)var a=setInterval(function(){m||(f(d),clearInterval(a))},300);else f(d)},200);k++;k>=e&&f(d)}else d.undoManger.save(!1,!0),q=!1});this.addListener("keyup",function(a,b){if(!l[b.keyCode||b.which]&&(!b.ctrlKey&&!b.metaKey&&!b.shiftKey&&!b.altKey)&&!m&&!q)this.undoManger.save(!1,!0),q=!0})};UE.plugins.paste=
function(){function a(a){var b=this.document;if(!b.getElementById("baidu_pastebin")){var c=this.selection.getRange(),d=c.createBookmark(),e=b.createElement("div");e.id="baidu_pastebin";n.webkit&&e.appendChild(b.createTextNode(f.fillChar+f.fillChar));b.body.appendChild(e);d.start.style.display="";e.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;left:-1000px;white-space:nowrap;top:"+f.getXY(d.start).y+"px";c.selectNodeContents(e).select(!0);setTimeout(function(){if(n.webkit)for(var m=
0,p=b.querySelectorAll("#baidu_pastebin"),q;q=p[m++];)if(f.isEmptyNode(q))f.remove(q);else{e=q;break}try{e.parentNode.removeChild(e)}catch(E){}c.moveToBookmark(d).select(!0);a(e)},0)}}var b=this,c,d,e;b.addListener("pasteTransfer",function(a,h){if(e&&c&&d&&c!=d){var j=b.selection.getRange();j.moveToAddress(e,!0);if(!j.collapsed){for(;!f.isBody(j.startContainer);){var l=j.startContainer;if(1==l.nodeType){l=l.childNodes[j.startOffset];if(!l){j.setStartBefore(j.startContainer);continue}(l=l.previousSibling)&&
(3==l.nodeType&&RegExp("^[\n\r\t "+f.fillChar+"]*$").test(l.nodeValue))&&j.setStartBefore(l)}if(0==j.startOffset)j.setStartBefore(j.startContainer);else break}for(;!f.isBody(j.endContainer);){l=j.endContainer;if(1==l.nodeType){l=l.childNodes[j.endOffset];if(!l){j.setEndAfter(j.endContainer);continue}(l=l.nextSibling)&&(3==l.nodeType&&RegExp("^[\n\r\t"+f.fillChar+"]*$").test(l.nodeValue))&&j.setEndAfter(l)}if(j.endOffset==j.endContainer.childNodes.length)j.setEndAfter(j.endContainer);else break}}j.deleteContents();
j.select(!0);b.__hasEnterExecCommand=!0;j=d;2===h?j=j.replace(/<(\/?)([\w\-]+)([^>]*)>/gi,function(a,b,c,d){c=c.toLowerCase();if({img:1}[c])return a;d=d.replace(/([\w\-]*?)\s*=\s*(("([^"]*)")|('([^']*)')|([^\s>]+))/gi,function(a,b,c){return{src:1,href:1,name:1}[b.toLowerCase()]?b+"="+c+" ":""});return{span:1,div:1}[c]?"":"<"+b+c+" "+p.trim(d)+">"}):h&&(j=c);b.execCommand("inserthtml",j,!0);b.__hasEnterExecCommand=!1;j=b.selection.getRange().createAddress(!0);e.endAddress=j.startAddress}});b.addListener("ready",
function(){f.on(b.body,"cut",function(){!b.selection.getRange().collapsed&&b.undoManger&&b.undoManger.save()});f.on(b.body,n.ie||n.opera?"keydown":"paste",function(g){(!n.ie&&!n.opera||!(!g.ctrlKey&&!g.metaKey||"86"!=g.keyCode))&&a.call(b,function(a){var g;if(a.firstChild){var l=f.getElementsByTagName(a,"span");g=0;for(var k;k=l[g++];)("_baidu_cut_start"==k.id||"_baidu_cut_end"==k.id)&&f.remove(k);if(n.webkit){k=a.querySelectorAll("div br");for(g=0;l=k[g++];)l=l.parentNode,"DIV"==l.tagName&&1==l.childNodes.length&&
(l.innerHTML="<p><br/></p>",f.remove(l));l=a.querySelectorAll("#baidu_pastebin");for(g=0;k=l[g++];){var m=b.document.createElement("p");for(k.parentNode.insertBefore(m,k);k.firstChild;)m.appendChild(k.firstChild);f.remove(k)}k=a.querySelectorAll("meta");for(g=0;l=k[g++];)f.remove(l);k=a.querySelectorAll("br");for(g=0;l=k[g++];)/^apple-/i.test(l.className)&&f.remove(l)}if(n.gecko){k=a.querySelectorAll("[_moz_dirty]");for(g=0;l=k[g++];)l.removeAttribute("_moz_dirty")}if(!n.ie){k=a.querySelectorAll("span.Apple-style-span");
for(g=0;l=k[g++];)f.remove(l,!0)}g=a.innerHTML;g=UE.filterWord(g);a=UE.htmlparser(g,!0);b.options.filterRules&&UE.filterNode(a,b.options.filterRules);b.filterInputRule(a);n.webkit&&((g=a.lastChild())&&("element"==g.type&&"br"==g.tagName)&&a.removeChild(g),p.each(b.body.querySelectorAll("div"),function(a){f.isEmptyBlock(a)&&f.remove(a)}));g={html:a.toHtml()};b.fireEvent("beforepaste",g,a);g.html&&(a=UE.htmlparser(g.html,!0),1===b.queryCommandState("pasteplain")?b.execCommand("insertHtml",UE.filterNode(a,
b.options.filterTxtRules).toHtml(),!0):(UE.filterNode(a,b.options.filterTxtRules),c=a.toHtml(),d=g.html,e=b.selection.getRange().createAddress(!0),b.execCommand("insertHtml",d,!0)),b.fireEvent("afterpaste",g))}})})})};UE.plugins.list=function(){function a(a){var b=[],c;for(c in a)b.push(c);return b}function b(a){var b=a.className;return f.hasClass(a,/custom_/)?b.match(/custom_(\w+)/)[1]:f.getStyle(a,"list-style-type")}function c(a,c){p.each(f.getElementsByTagName(a,"ol ul"),function(g){if(f.inDoc(g,
a)){var h=g.parentNode;if(h.tagName==g.tagName){var j=b(g)||("OL"==g.tagName?"decimal":"disc"),l=b(h)||("OL"==h.tagName?"decimal":"disc");j==l&&(j=p.indexOf(m[g.tagName],j),j=j+1==m[g.tagName].length?0:j+1,e(g,m[g.tagName][j]))}var r=0,j=2;if(f.hasClass(g,/custom_/)){if(!/[ou]l/i.test(h.tagName)||!f.hasClass(h,/custom_/))j=1}else/[ou]l/i.test(h.tagName)&&f.hasClass(h,/custom_/)&&(j=3);(h=f.getStyle(g,"list-style-type"))&&(g.style.cssText="list-style-type:"+h);g.className=p.trim(g.className.replace(/list-paddingleft-\w+/,
""))+" list-paddingleft-"+j;p.each(f.getElementsByTagName(g,"li"),function(a){a.style.cssText&&(a.style.cssText="");if(a.firstChild){if(a.parentNode===g){r++;if(f.hasClass(g,/custom_/)){var c=1,d=b(g);if("OL"==g.tagName){if(d)switch(d){case "cn":case "cn1":case "cn2":10<r&&(0==r%10||10<r&&20>r)?c=2:20<r&&(c=3);break;case "num2":9<r&&(c=2)}a.className="list-"+k[d]+r+" list-"+d+"-paddingleft-"+c}else a.className="list-"+k[d]+" list-"+d+"-paddingleft"}else a.className=a.className.replace(/list-[\w\-]+/gi,
"");c=a.getAttribute("class");null!==c&&!c.replace(/\s/g,"")&&f.removeAttributes(a,"class")}}else f.remove(a)});!c&&d(g,g.tagName.toLowerCase(),b(g)||f.getStyle(g,"list-style-type"),!0)}})}function d(a,d,e,g){var h=a.nextSibling;if(h&&1==h.nodeType&&h.tagName.toLowerCase()==d&&(b(h)||f.getStyle(h,"list-style-type")||("ol"==d?"decimal":"disc"))==e)f.moveChild(h,a),0==h.childNodes.length&&f.remove(h);h&&f.isFillChar(h)&&f.remove(h);(h=a.previousSibling)&&(1==h.nodeType&&h.tagName.toLowerCase()==d&&
(b(h)||f.getStyle(h,"list-style-type")||("ol"==d?"decimal":"disc"))==e)&&f.moveChild(a,h);h&&f.isFillChar(h)&&f.remove(h);!g&&f.isEmptyBlock(a)&&f.remove(a);b(a)&&c(a.ownerDocument,!0)}function e(a,b){k[b]&&(a.className="custom_"+b);try{f.setStyle(a,"list-style-type",b)}catch(c){}}function g(a){var b=a.previousSibling;b&&f.isEmptyBlock(b)&&f.remove(b);(b=a.nextSibling)&&f.isEmptyBlock(b)&&f.remove(b)}function h(a){for(;a&&!f.isBody(a);){if("TABLE"==a.nodeName)return null;if("LI"==a.nodeName)return a;
a=a.parentNode}}var j=this,l={TD:1,PRE:1,BLOCKQUOTE:1},k={cn:"cn-1-",cn1:"cn-2-",cn2:"cn-3-",num:"num-1-",num1:"num-2-",num2:"num-3-",dash:"dash",dot:"dot"};j.setOpt({insertorderedlist:{num:"",num1:"",num2:"",cn:"",cn1:"",cn2:"",decimal:"","lower-alpha":"","lower-roman":"","upper-alpha":"","upper-roman":""},insertunorderedlist:{circle:"",disc:"",square:"",dash:"",dot:""},listDefaultPaddingLeft:"30",listiconpath:"http://bs.baidu.com/listicon/",maxListLevel:-1});var m={OL:a(j.options.insertorderedlist),
UL:a(j.options.insertunorderedlist)},q=j.options.listiconpath,v;for(v in k)!j.options.insertorderedlist.hasOwnProperty(v)&&!j.options.insertunorderedlist.hasOwnProperty(v)&&delete k[v];j.ready(function(){var a=[],b;for(b in k){if("dash"==b||"dot"==b)a.push("li.list-"+k[b]+"{background-image:url("+q+k[b]+".gif)}"),a.push("ul.custom_"+b+"{list-style:none;}ul.custom_"+b+" li{background-position:0 3px;background-repeat:no-repeat}");else{for(var c=0;99>c;c++)a.push("li.list-"+k[b]+c+"{background-image:url("+
q+"list-"+k[b]+c+".gif)}");a.push("ol.custom_"+b+"{list-style:none;}ol.custom_"+b+" li{background-position:0 3px;background-repeat:no-repeat}")}switch(b){case "cn":a.push("li.list-"+b+"-paddingleft-1{padding-left:25px}");a.push("li.list-"+b+"-paddingleft-2{padding-left:40px}");a.push("li.list-"+b+"-paddingleft-3{padding-left:55px}");break;case "cn1":a.push("li.list-"+b+"-paddingleft-1{padding-left:30px}");a.push("li.list-"+b+"-paddingleft-2{padding-left:40px}");a.push("li.list-"+b+"-paddingleft-3{padding-left:55px}");
break;case "cn2":a.push("li.list-"+b+"-paddingleft-1{padding-left:40px}");a.push("li.list-"+b+"-paddingleft-2{padding-left:55px}");a.push("li.list-"+b+"-paddingleft-3{padding-left:68px}");break;case "num":case "num1":a.push("li.list-"+b+"-paddingleft-1{padding-left:25px}");break;case "num2":a.push("li.list-"+b+"-paddingleft-1{padding-left:35px}");a.push("li.list-"+b+"-paddingleft-2{padding-left:40px}");break;case "dash":a.push("li.list-"+b+"-paddingleft{padding-left:35px}");break;case "dot":a.push("li.list-"+
b+"-paddingleft{padding-left:20px}")}}a.push(".list-paddingleft-1{padding-left:0}");a.push(".list-paddingleft-2{padding-left:"+j.options.listDefaultPaddingLeft+"px}");a.push(".list-paddingleft-3{padding-left:"+2*j.options.listDefaultPaddingLeft+"px}");p.cssRule("list","ol,ul{margin:0;pading:0;"+(n.ie?"":"width:95%")+"}li{clear:both;}"+a.join("\n"),j.document)});j.ready(function(){f.on(j.body,"cut",function(){setTimeout(function(){var a=j.selection.getRange(),b;if((b=f.findParentByTagName(a.startContainer,
"li",!0))&&!b.nextSibling&&f.isEmptyBlock(b)){b=b.parentNode;var c;(c=b.previousSibling)?(f.remove(b),a.setStartAtLast(c).collapse(!0)):(c=b.nextSibling)?(f.remove(b),a.setStartAtFirst(c).collapse(!0)):(c=j.document.createElement("p"),f.fillNode(j.document,c),b.parentNode.insertBefore(c,b),f.remove(b),a.setStart(c,0).collapse(!0));a.select(!0)}})})});j.addListener("beforepaste",function(a,c){var d=this.selection.getRange(),e=UE.htmlparser(c.html,!0);if(d=f.findParentByTagName(d.startContainer,"li",
!0)){var g=d.parentNode;p.each(e.getNodesByTagName("OL"==g.tagName?"ul":"ol"),function(c){c.tagName=g.tagName;c.setAttr();if(c.parentNode===e)a=b(g)||("OL"==g.tagName?"decimal":"disc");else{var d=c.parentNode.getAttr("class");(a=d&&/custom_/.test(d)?d.match(/custom_(\w+)/)[1]:c.parentNode.getStyle("list-style-type"))||(a="OL"==g.tagName?"decimal":"disc")}d=p.indexOf(m[g.tagName],a);c.parentNode!==e&&(d=d+1==m[g.tagName].length?0:d+1);d=m[g.tagName][d];k[d]?c.setAttr("class","custom_"+d):c.setStyle("list-style-type",
d)})}c.html=e.toHtml()});j.addInputRule(function(a){function b(a,e){var f=e.firstChild();if(f&&"element"==f.type&&"span"==f.tagName&&/Wingdings|Symbol/.test(f.getStyle("font-family"))){for(var g in d)if(d[g]==f.data)return g;return"disc"}for(g in c)if(c[g].test(a))return g}p.each(a.getNodesByTagName("li"),function(a){for(var b=UE.uNode.createElement("p"),c=0,d;d=a.children[c];)"text"==d.type||t.p[d.tagName]?b.appendChild(d):b.firstChild()?(a.insertBefore(b,d),b=UE.uNode.createElement("p"),c+=2):c++;
(b.firstChild()&&!b.parentNode||!a.firstChild())&&a.appendChild(b)});var c={num1:/^\d+\)/,decimal:/^\d+\./,"lower-alpha":/^[a-z]+\)/,"upper-alpha":/^[A-Z]+\./,cn:/^[\u4E00\u4E8C\u4E09\u56DB\u516d\u4e94\u4e03\u516b\u4e5d]+[\u3001]/,cn2:/^\([\u4E00\u4E8C\u4E09\u56DB\u516d\u4e94\u4e03\u516b\u4e5d]+\)/},d={square:"n"};p.each(a.getNodesByTagName("p"),function(a){if("MsoListParagraph"==a.getAttr("class")){a.setAttr("class","");var d=a,e;if("li"!=a.parentNode.tagName&&(e=b(a.innerText(),a))){var f=UE.uNode.createElement(j.options.insertorderedlist.hasOwnProperty(e)?
"ol":"ul");for(k[e]?f.setAttr("class","custom_"+e):f.setStyle("list-style-type",e);a&&"li"!=a.parentNode.tagName&&b(a.innerText(),a);){(d=a.nextSibling())||a.parentNode.insertBefore(f,a);var g=f,h=e;"ol"==g.tagName?a.innerHTML(a.innerHTML().replace(c[h],"")):a.removeChild(a.firstChild());h=UE.uNode.createElement("li");h.appendChild(a);g.appendChild(h);a=d}!f.parentNode&&(a&&a.parentNode)&&a.parentNode.insertBefore(f,a)}}})});j.addListener("contentchange",function(){c(j.document)});j.addListener("keydown",
function(a,b){function c(){b.preventDefault?b.preventDefault():b.returnValue=!1;j.fireEvent("contentchange");j.undoManger&&j.undoManger.save()}function d(a,b){for(;a&&!f.isBody(a)&&!b(a);){if(1==a.nodeType&&/[ou]l/i.test(a.tagName))return a;a=a.parentNode}return null}var e=b.keyCode||b.which;if(13==e&&!b.shiftKey){var h=j.selection.getRange(),l=f.findParent(h.startContainer,function(a){return f.isBlockElm(a)},!0),k=f.findParentByTagName(h.startContainer,"li",!0);l&&("PRE"!=l.tagName&&!k)&&(k=l.innerHTML.replace(RegExp(f.fillChar,
"g"),""),/^\s*1\s*\.[^\d]/.test(k)&&(l.innerHTML=k.replace(/^\s*1\s*\./,""),h.setStartAtLast(l).collapse(!0).select(),j.__hasEnterExecCommand=!0,j.execCommand("insertorderedlist"),j.__hasEnterExecCommand=!1));h=j.selection.getRange();l=d(h.startContainer,function(a){return"TABLE"==a.tagName});k=h.collapsed?l:d(h.endContainer,function(a){return"TABLE"==a.tagName});if(l&&k&&l===k){if(!h.collapsed)if(l=f.findParentByTagName(h.startContainer,"li",!0),k=f.findParentByTagName(h.endContainer,"li",!0),l&&
k&&l===k){if(h.deleteContents(),(k=f.findParentByTagName(h.startContainer,"li",!0))&&f.isEmptyBlock(k)){n=k.previousSibling;next=k.nextSibling;l=j.document.createElement("p");f.fillNode(j.document,l);p=k.parentNode;n&&next?(h.setStart(next,0).collapse(!0).select(!0),f.remove(k)):(!n&&!next||!n?p.parentNode.insertBefore(l,p):k.parentNode.parentNode.insertBefore(l,p.nextSibling),f.remove(k),p.firstChild||f.remove(p),h.setStart(l,0).setCursor());c();return}}else{var l=h.cloneRange(),m=l.collapse(!1).createBookmark();
h.deleteContents();l.moveToBookmark(m);k=f.findParentByTagName(l.startContainer,"li",!0);g(k);l.select();c();return}if(k=f.findParentByTagName(h.startContainer,"li",!0)){if(f.isEmptyBlock(k)){var m=h.createBookmark(),p=k.parentNode;k!==p.lastChild?(f.breakParent(k,p),g(k)):(p.parentNode.insertBefore(k,p.nextSibling),f.isEmptyNode(p)&&f.remove(p));if(!t.$list[k.parentNode.tagName])if(f.isBlockElm(k.firstChild))f.remove(k,!0);else{l=j.document.createElement("p");for(k.parentNode.insertBefore(l,k);k.firstChild;)l.appendChild(k.firstChild);
f.remove(k)}h.moveToBookmark(m).select()}else{l=k.firstChild;if(!l||!f.isBlockElm(l)){l=j.document.createElement("p");for(!k.firstChild&&f.fillNode(j.document,l);k.firstChild;)l.appendChild(k.firstChild);k.appendChild(l)}m=j.document.createElement("span");h.insertNode(m);f.breakParent(m,k);n=m.nextSibling;l=n.firstChild;l||(l=j.document.createElement("p"),f.fillNode(j.document,l),n.appendChild(l));f.isEmptyNode(l)&&(l.innerHTML="",f.fillNode(j.document,l));h.setStart(l,0).collapse(!0).shrinkBoundary().select();
f.remove(m);var n=n.previousSibling;n&&f.isEmptyBlock(n)&&(n.innerHTML="<p></p>",f.fillNode(j.document,n.firstChild))}c()}}}if(8==e&&(h=j.selection.getRange(),h.collapsed&&f.isStartInblock(h)&&(l=h.cloneRange().trimBoundary(),(k=f.findParentByTagName(h.startContainer,"li",!0))&&f.isStartInblock(l))))if((l=f.findParentByTagName(h.startContainer,"p",!0))&&l!==k.firstChild)p=f.findParentByTagName(l,["ol","ul"]),f.breakParent(l,p),g(l),j.fireEvent("contentchange"),h.setStart(l,0).setCursor(!1,!0),j.fireEvent("saveScene"),
f.preventDefault(b);else if(k&&(n=k.previousSibling)){if(!(46==e&&k.childNodes.length)){t.$list[n.tagName]&&(n=n.lastChild);j.undoManger&&j.undoManger.save();l=k.firstChild;if(f.isBlockElm(l))if(f.isEmptyNode(l)){n.appendChild(l);for(h.setStart(l,0).setCursor(!1,!0);k.firstChild;)n.appendChild(k.firstChild)}else m=j.document.createElement("span"),h.insertNode(m),f.isEmptyBlock(n)&&(n.innerHTML=""),f.moveChild(k,n),h.setStartBefore(m).collapse(!0).select(!0),f.remove(m);else if(f.isEmptyNode(k))l=
j.document.createElement("p"),n.appendChild(l),h.setStart(l,0).setCursor();else for(h.setEnd(n,n.childNodes.length).collapse().select(!0);k.firstChild;)n.appendChild(k.firstChild);f.remove(k);j.fireEvent("contentchange");j.fireEvent("saveScene");f.preventDefault(b)}}else if(k&&!k.previousSibling){p=k.parentNode;m=h.createBookmark();if(f.isTagNode(p.parentNode,"ol ul"))p.parentNode.insertBefore(k,p);else{for(;k.firstChild;)p.parentNode.insertBefore(k.firstChild,p);f.remove(k)}f.isEmptyNode(p)&&f.remove(p);
h.moveToBookmark(m).setCursor(!1,!0);j.fireEvent("contentchange");j.fireEvent("saveScene");f.preventDefault(b)}});j.addListener("keyup",function(a,c){if(8==(c.keyCode||c.which)){var e=j.selection.getRange();if(e=f.findParentByTagName(e.startContainer,["ol","ul"],!0))d(e,e.tagName.toLowerCase(),b(e)||f.getComputedStyle(e,"list-style-type"),!0)}});j.addListener("tabkeydown",function(){function a(b){if(-1!=j.options.maxListLevel){b=b.parentNode;for(var c=0;/[ou]l/i.test(b.tagName);)c++,b=b.parentNode;
if(c>=j.options.maxListLevel)return!0}}var c=j.selection.getRange(),g=f.findParentByTagName(c.startContainer,"li",!0);if(g){var h;if(c.collapsed){if(a(g))return!0;var l=g.parentNode,k=j.document.createElement(l.tagName),n=p.indexOf(m[k.tagName],b(l)||f.getComputedStyle(l,"list-style-type")),n=n+1==m[k.tagName].length?0:n+1,n=m[k.tagName][n];e(k,n);if(f.isStartInblock(c))return j.fireEvent("saveScene"),h=c.createBookmark(),l.insertBefore(k,g),k.appendChild(g),d(k,k.tagName.toLowerCase(),n),j.fireEvent("contentchange"),
c.moveToBookmark(h).select(!0),!0}else{j.fireEvent("saveScene");h=c.createBookmark();for(var l=0,q,k=f.findParents(g),C;C=k[l++];)if(f.isTagNode(C,"ol ul")){q=C;break}C=g;if(h.end)for(;C&&!(f.getPosition(C,h.end)&f.POSITION_FOLLOWING);)if(a(C))C=f.getNextDomNode(C,!1,null,function(a){return a!==q});else{l=C.parentNode;k=j.document.createElement(l.tagName);n=p.indexOf(m[k.tagName],b(l)||f.getComputedStyle(l,"list-style-type"));n=m[k.tagName][n+1==m[k.tagName].length?0:n+1];e(k,n);for(l.insertBefore(k,
C);C&&!(f.getPosition(C,h.end)&f.POSITION_FOLLOWING);){g=C.nextSibling;k.appendChild(C);if(!g||f.isTagNode(g,"ol ul")){if(g)for(;(g=g.firstChild)&&"LI"!=g.tagName;);else g=f.getNextDomNode(C,!1,null,function(a){return a!==q});break}C=g}d(k,k.tagName.toLowerCase(),n);C=g}j.fireEvent("contentchange");c.moveToBookmark(h).select();return!0}}});j.commands.insertorderedlist=j.commands.insertunorderedlist={execCommand:function(a,c){c||(c="insertorderedlist"==a.toLowerCase()?"decimal":"disc");var g=this.selection.getRange(),
j=function(a){return 1==a.nodeType?"br"!=a.tagName.toLowerCase():!f.isWhitespace(a)},k="insertorderedlist"==a.toLowerCase()?"ol":"ul",m=this.document.createDocumentFragment();g.adjustmentBoundary().shrinkBoundary();var n=g.createBookmark(!0),q=h(this.document.getElementById(n.start)),C=0,v=h(this.document.getElementById(n.end)),y=0,z,x,w,u;if(q||v){q&&(z=q.parentNode);n.end||(v=q);v&&(x=v.parentNode);if(z===x){for(;q!==v;){u=q;q=q.nextSibling;if(!f.isBlockElm(u.firstChild)){for(j=this.document.createElement("p");u.firstChild;)j.appendChild(u.firstChild);
u.appendChild(j)}m.appendChild(u)}u=this.document.createElement("span");z.insertBefore(u,v);if(!f.isBlockElm(v.firstChild)){for(j=this.document.createElement("p");v.firstChild;)j.appendChild(v.firstChild);v.appendChild(j)}m.appendChild(v);f.breakParent(u,z);f.isEmptyNode(u.previousSibling)&&f.remove(u.previousSibling);f.isEmptyNode(u.nextSibling)&&f.remove(u.nextSibling);j=b(z)||f.getComputedStyle(z,"list-style-type")||("insertorderedlist"==a.toLowerCase()?"decimal":"disc");if(z.tagName.toLowerCase()==
k&&j==c){for(var j=0,F=this.document.createDocumentFragment();v=m.childNodes[j++];)if(f.isTagNode(v,"ol ul"))p.each(f.getElementsByTagName(v,"li"),function(a){for(;a.firstChild;)F.appendChild(a.firstChild)});else for(;v.firstChild;)F.appendChild(v.firstChild);u.parentNode.insertBefore(F,u)}else w=this.document.createElement(k),e(w,c),w.appendChild(m),u.parentNode.insertBefore(w,u);f.remove(u);w&&d(w,k,c);g.moveToBookmark(n).select();return}if(q){for(;q;){u=q.nextSibling;if(f.isTagNode(q,"ol ul"))m.appendChild(q);
else{w=this.document.createDocumentFragment();for(var B=0;q.firstChild;)f.isBlockElm(q.firstChild)&&(B=1),w.appendChild(q.firstChild);B?m.appendChild(w):(B=this.document.createElement("p"),B.appendChild(w),m.appendChild(B));f.remove(q)}q=u}z.parentNode.insertBefore(m,z.nextSibling);f.isEmptyNode(z)?(g.setStartBefore(z),f.remove(z)):g.setStartAfter(z);C=1}if(v&&f.inDoc(x,this.document)){for(q=x.firstChild;q&&q!==v;){u=q.nextSibling;if(f.isTagNode(q,"ol ul"))m.appendChild(q);else{w=this.document.createDocumentFragment();
for(B=0;q.firstChild;)f.isBlockElm(q.firstChild)&&(B=1),w.appendChild(q.firstChild);B?m.appendChild(w):(B=this.document.createElement("p"),B.appendChild(w),m.appendChild(B));f.remove(q)}q=u}u=f.createElement(this.document,"div",{tmpDiv:1});f.moveChild(v,u);m.appendChild(u);f.remove(v);x.parentNode.insertBefore(m,x);g.setEndBefore(x);f.isEmptyNode(x)&&f.remove(x);y=1}}C||g.setStartBefore(this.document.getElementById(n.start));n.end&&!y&&g.setEndAfter(this.document.getElementById(n.end));g.enlarge(!0,
function(a){return l[a.tagName]});m=this.document.createDocumentFragment();v=g.createBookmark();z=f.getNextDomNode(v.start,!1,j);q=g.cloneRange();for(x=f.isBlockElm;z&&z!==v.end&&f.getPosition(z,v.end)&f.POSITION_PRECEDING;)if(3==z.nodeType||t.li[z.tagName])if(1==z.nodeType&&t.$list[z.tagName]){for(;z.firstChild;)m.appendChild(z.firstChild);C=f.getNextDomNode(z,!1,j);f.remove(z);z=C}else{C=z;for(q.setStartBefore(z);z&&z!==v.end&&(!x(z)||f.isBookmarkNode(z));)C=z,z=f.getNextDomNode(z,!1,null,function(a){return!l[a.tagName]});
if(z&&x(z)&&(u=f.getNextDomNode(C,!1,j))&&f.isBookmarkNode(u))z=f.getNextDomNode(u,!1,j),C=u;q.setEndAfter(C);z=f.getNextDomNode(C,!1,j);u=g.document.createElement("li");u.appendChild(q.extractContents());if(f.isEmptyNode(u)){for(C=g.document.createElement("p");u.firstChild;)C.appendChild(u.firstChild);u.appendChild(C)}m.appendChild(u)}else z=f.getNextDomNode(z,!0,j);g.moveToBookmark(v).collapse(!0);w=this.document.createElement(k);e(w,c);w.appendChild(m);g.insertNode(w);d(w,k,c);j=0;for(k=f.getElementsByTagName(w,
"div");v=k[j++];)v.getAttribute("tmpDiv")&&f.remove(v,!0);g.moveToBookmark(n).select()},queryCommandState:function(a){a="insertorderedlist"==a.toLowerCase()?"ol":"ul";for(var b=this.selection.getStartElementPath(),c=0,d;(d=b[c++])&&"TABLE"!=d.nodeName;)if(a==d.nodeName.toLowerCase())return 1;return 0},queryCommandValue:function(a){a="insertorderedlist"==a.toLowerCase()?"ol":"ul";for(var c=this.selection.getStartElementPath(),d,e=0,g;g=c[e++];){if("TABLE"==g.nodeName){d=null;break}if(a==g.nodeName.toLowerCase()){d=
g;break}}return d?b(d)||f.getComputedStyle(d,"list-style-type"):null}}};var Pc={textarea:function(a,b){var c=b.ownerDocument.createElement("textarea");c.style.cssText="position:absolute;resize:none;width:100%;height:100%;border:0;padding:0;margin:0;overflow-y:auto;";n.ie&&8>n.version&&(c.style.width=b.offsetWidth+"px",c.style.height=b.offsetHeight+"px",b.onresize=function(){c.style.width=b.offsetWidth+"px";c.style.height=b.offsetHeight+"px"});b.appendChild(c);return{setContent:function(a){c.value=
a},getContent:function(){return c.value},select:function(){var a;n.ie?(a=c.createTextRange(),a.collapse(!0),a.select()):(c.setSelectionRange(0,0),c.focus())},dispose:function(){b.removeChild(c);b=c=b.onresize=null}}},codemirror:function(a,b){var c=window.CodeMirror(b,{mode:"text/html",tabMode:"indent",lineNumbers:!0,lineWrapping:!0}),d=c.getWrapperElement();d.style.cssText='position:absolute;left:0;top:0;width:100%;height:100%;font-family:consolas,"Courier new",monospace;font-size:13px;';c.getScrollerElement().style.cssText=
"position:absolute;left:0;top:0;width:100%;height:100%;";c.refresh();return{getCodeMirror:function(){return c},setContent:function(a){c.setValue(a)},getContent:function(){return c.getValue()},select:function(){c.focus()},dispose:function(){b.removeChild(d);c=d=null}}}};UE.plugins.source=function(){var a=this,b=this.options,c=!1,d;b.sourceEditor=n.ie?"textarea":b.sourceEditor||"codemirror";a.setOpt({sourceEditorFirst:!1});var e,g=a.getContent,h;a.commands.source={execCommand:function(){if(c=!c){h=
a.selection.getRange().createAddress(!1,!0);a.undoManger&&a.undoManger.save(!0);n.gecko&&(a.body.contentEditable=!1);e=a.iframe.style.cssText;a.iframe.style.cssText+="position:absolute;left:-32768px;top:-32768px;";a.fireEvent("beforegetcontent");var j=UE.htmlparser(a.body.innerHTML,!0);a.filterOutputRule(j);j.traversal(function(a){if("element"==a.type)switch(a.tagName){case "td":case "th":case "caption":a.children&&1==a.children.length&&"br"==a.firstChild().tagName&&a.removeChild(a.firstChild());
break;case "pre":a.innerText(a.innerText().replace(/&nbsp;/g," "))}});a.fireEvent("aftergetcontent");j=j.toHtml(!0);d=Pc["codemirror"==b.sourceEditor&&window.CodeMirror?"codemirror":"textarea"](a,a.iframe.parentNode);d.setContent(j);setTimeout(function(){d.select();a.addListener("fullscreenchanged",function(){try{d.getCodeMirror().refresh()}catch(a){}})});a.getContent=function(){return d.getContent()||"<p>"+(n.ie?"":"<br/>")+"</p>"}}else if(a.iframe.style.cssText=e,j=d.getContent()||"<p>"+(n.ie?"":
"<br/>")+"</p>",a.setContent(j),d.dispose(),d=null,a.getContent=g,j=a.body.firstChild,j||(a.body.innerHTML="<p>"+(n.ie?"":"<br/>")+"</p>",j=a.body.firstChild),a.undoManger&&a.undoManger.save(!0),n.gecko){var k=document.createElement("input");k.style.cssText="position:absolute;left:0;top:-32768px";document.body.appendChild(k);a.body.contentEditable=!1;setTimeout(function(){f.setViewportOffset(k,{left:-32768,top:0});k.focus();setTimeout(function(){a.body.contentEditable=!0;a.selection.getRange().moveToAddress(h).select(!0);
f.remove(k)})})}else try{a.selection.getRange().moveToAddress(h).select(!0)}catch(m){}this.fireEvent("sourcemodechanged",c)},queryCommandState:function(){return c|0},notNeedUndo:1};var j=a.queryCommandState;a.queryCommandState=function(a){a=a.toLowerCase();return c?a in{source:1,fullscreen:1}?1:-1:j.apply(this,arguments)};"codemirror"==b.sourceEditor&&a.addListener("ready",function(){p.loadFile(document,{src:b.codeMirrorJsUrl||b.UEDITOR_HOME_URL+"third-party/codemirror/codemirror.js",tag:"script",
type:"text/javascript",defer:"defer"},function(){b.sourceEditorFirst&&setTimeout(function(){a.execCommand("source")},0)});p.loadFile(document,{tag:"link",rel:"stylesheet",type:"text/css",href:b.codeMirrorCssUrl||b.UEDITOR_HOME_URL+"third-party/codemirror/codemirror.css"})})};UE.plugins.enterkey=function(){var a,b=this,c=b.options.enterTag;b.addListener("keyup",function(c,e){if(13==(e.keyCode||e.which)){var g=b.selection.getRange(),h=g.startContainer,j;if(n.ie)b.fireEvent("saveScene",!0,!0);else{if(/h\d/i.test(a)){if(n.gecko)f.findParentByTagName(h,
"h1 h2 h3 h4 h5 h6 blockquote caption table".split(" "),!0)||(b.document.execCommand("formatBlock",!1,"<p>"),j=1);else if(1==h.nodeType){var h=b.document.createTextNode(""),l;g.insertNode(h);if(l=f.findParentByTagName(h,"div",!0)){for(j=b.document.createElement("p");l.firstChild;)j.appendChild(l.firstChild);l.parentNode.insertBefore(j,l);f.remove(l);g.setStartBefore(h).setCursor();j=1}f.remove(h)}b.undoManger&&j&&b.undoManger.save()}n.opera&&g.select()}}});b.addListener("keydown",function(d,e){if(13==
(e.keyCode||e.which))if(b.fireEvent("beforeenterkeydown"))f.preventDefault(e);else{b.fireEvent("saveScene",!0,!0);a="";var g=b.selection.getRange();if(!g.collapsed){var h=g.startContainer,j=g.endContainer,h=f.findParentByTagName(h,"td",!0),j=f.findParentByTagName(j,"td",!0);if(h&&j&&h!==j||!h&&j||h&&!j){e.preventDefault?e.preventDefault():e.returnValue=!1;return}}if("p"==c)n.ie||(h=f.findParentByTagName(g.startContainer,"ol ul p h1 h2 h3 h4 h5 h6 blockquote caption".split(" "),!0),!h&&!n.opera?(b.document.execCommand("formatBlock",
!1,"<p>"),n.gecko&&(g=b.selection.getRange(),(h=f.findParentByTagName(g.startContainer,"p",!0))&&f.removeDirtyAttr(h))):(a=h.tagName,"p"==h.tagName.toLowerCase()&&n.gecko&&f.removeDirtyAttr(h)));else if(e.preventDefault?e.preventDefault():e.returnValue=!1,g.collapsed)j=g.document.createElement("br"),g.insertNode(j),j.parentNode.lastChild===j?(j.parentNode.insertBefore(j.cloneNode(!0),j),g.setStartBefore(j)):g.setStartAfter(j),g.setCursor();else if(g.deleteContents(),h=g.startContainer,1==h.nodeType&&
(h=h.childNodes[g.startOffset])){for(;1==h.nodeType;){if(t.$empty[h.tagName])return g.setStartBefore(h).setCursor(),b.undoManger&&b.undoManger.save(),!1;if(!h.firstChild)return j=g.document.createElement("br"),h.appendChild(j),g.setStart(h,0).setCursor(),b.undoManger&&b.undoManger.save(),!1;h=h.firstChild}h===g.startContainer.childNodes[g.startOffset]?(j=g.document.createElement("br"),g.insertNode(j).setCursor()):g.setStart(h,0).setCursor()}else j=g.document.createElement("br"),g.insertNode(j).setStartAfter(j).setCursor()}})};
UE.plugins.keystrokes=function(){var a=this,b=!0;a.addListener("keydown",function(c,d){var e=d.keyCode||d.which,g=a.selection.getRange();if(!g.collapsed&&!d.ctrlKey&&(!d.shiftKey&&!d.altKey&&!d.metaKey)&&(65<=e&&90>=e||48<=e&&57>=e||96<=e&&111>=e||{13:1,8:1,46:1}[e])){var h=g.startContainer;f.isFillChar(h)&&g.setStartBefore(h);h=g.endContainer;f.isFillChar(h)&&g.setEndAfter(h);g.txtToElmBoundary();g.endContainer&&1==g.endContainer.nodeType&&(h=g.endContainer.childNodes[g.endOffset])&&f.isBr(h)&&g.setEndAfter(h);
if(0==g.startOffset&&(h=g.startContainer,f.isBoundaryNode(h,"firstChild")&&(h=g.endContainer,g.endOffset==(3==h.nodeType?h.nodeValue.length:h.childNodes.length)&&f.isBoundaryNode(h,"lastChild")))){a.fireEvent("saveScene");a.body.innerHTML="<p>"+(n.ie?"":"<br/>")+"</p>";g.setStart(a.body.firstChild,0).setCursor(!1,!0);a._selectionChange();return}}if(8==e){g=a.selection.getRange();b=g.collapsed;var j,l;g.collapsed&&g.inFillChar()&&(j=g.startContainer,f.isFillChar(j)?(g.setStartBefore(j).shrinkBoundary(!0).collapse(!0),
f.remove(j)):(j.nodeValue=j.nodeValue.replace(RegExp("^"+f.fillChar),""),g.startOffset--,g.collapse(!0).select(!0)));if(j=g.getClosedNode()){a.fireEvent("saveScene");g.setStartBefore(j);f.remove(j);g.setCursor();a.fireEvent("saveScene");f.preventDefault(d);return}if(!n.ie&&(j=f.findParentByTagName(g.startContainer,"table",!0),l=f.findParentByTagName(g.endContainer,"table",!0),j&&!l||!j&&l||j!==l)){d.preventDefault();return}}if(9==e){var k={ol:1,ul:1,table:1};if(a.fireEvent("tabkeydown",d)){f.preventDefault(d);
return}g=a.selection.getRange();a.fireEvent("saveScene");h=0;j="";l=a.options.tabSize||4;for(var m=a.options.tabNode||"&nbsp;";h<l;h++)j+=m;h=a.document.createElement("span");h.innerHTML=j+f.fillChar;if(g.collapsed)g.insertNode(h.cloneNode(!0).firstChild).setCursor(!0);else if(j=f.findParent(g.startContainer,p),l=f.findParent(g.endContainer,p),j&&l&&j===l)g.deleteContents(),g.insertNode(h.cloneNode(!0).firstChild).setCursor(!0);else{j=g.createBookmark();var p=function(a){return f.isBlockElm(a)&&!k[a.tagName.toLowerCase()]};
g.enlarge(!0);l=g.createBookmark();for(m=f.getNextDomNode(l.start,!1,p);m&&!(f.getPosition(m,l.end)&f.POSITION_FOLLOWING);)m.insertBefore(h.cloneNode(!0).firstChild,m.firstChild),m=f.getNextDomNode(m,!1,p);g.moveToBookmark(l).moveToBookmark(j).select()}f.preventDefault(d)}if(n.gecko&&46==e&&(g=a.selection.getRange(),g.collapsed&&(j=g.startContainer,f.isEmptyBlock(j)))){for(e=j.parentNode;1==f.getChildCount(e)&&!f.isBody(e);)j=e,e=e.parentNode;j===e.lastChild&&d.preventDefault()}});a.addListener("keyup",
function(a,d){var e;if(8==(d.keyCode||d.which)&&!this.fireEvent("delkeyup")){e=this.selection.getRange();if(e.collapsed){var g;if((g=f.findParentByTagName(e.startContainer,"h1 h2 h3 h4 h5 h6".split(" "),!0))&&f.isEmptyBlock(g)){var h=g.previousSibling;if(h&&"TABLE"!=h.nodeName){f.remove(g);e.setStartAtLast(h).setCursor(!1,!0);return}if((h=g.nextSibling)&&"TABLE"!=h.nodeName){f.remove(g);e.setStartAtFirst(h).setCursor(!1,!0);return}}f.isBody(e.startContainer)&&(g=f.createElement(this.document,"p",
{innerHTML:n.ie?f.fillChar:"<br/>"}),e.insertNode(g).setStart(g,0).setCursor(!1,!0))}if(!b&&(3==e.startContainer.nodeType||1==e.startContainer.nodeType&&f.isEmptyBlock(e.startContainer)))n.ie?(g=e.document.createElement("span"),e.insertNode(g).setStartBefore(g).collapse(!0),e.select(),f.remove(g)):e.select()}})};UE.plugins.fiximgclick=function(){var a=this;n.webkit&&a.addListener("click",function(b,c){"IMG"==c.target.tagName&&(new R.Range(a.document)).selectNode(c.target).select()})};UE.plugins.autolink=
function(){if(!n.ie){var a=this;a.addListener("reset",function(){});a.addListener("keydown",function(b,c){var d=c.keyCode||c.which;if(32==d||13==d){for(var d=a.selection.getNative(),e=d.getRangeAt(0).cloneRange(),g,h=e.startContainer;1==h.nodeType&&0<e.startOffset;){h=e.startContainer.childNodes[e.startOffset-1];if(!h)break;e.setStart(h,1==h.nodeType?h.childNodes.length:h.nodeValue.length);e.collapse(!0);h=e.startContainer}do{if(0==e.startOffset){for(h=e.startContainer.previousSibling;h&&1==h.nodeType;)h=
h.lastChild;if(!h||f.isFillChar(h))break;g=h.nodeValue.length}else h=e.startContainer,g=e.startOffset;e.setStart(h,g-1);g=e.toString().charCodeAt(0)}while(160!=g&&32!=g);if(e.toString().replace(RegExp(f.fillChar,"g"),"").match(/(?:https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)/i)){for(;e.toString().length&&!/^(?:https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)/i.test(e.toString());)try{e.setStart(e.startContainer,e.startOffset+1)}catch(j){for(h=e.startContainer;!(next=h.nextSibling);){if(f.isBody(h))return;
h=h.parentNode}e.setStart(next,0)}if(!f.findParentByTagName(e.startContainer,"a",!0)){g=a.document.createElement("a");var h=a.document.createTextNode(" "),l;a.undoManger&&a.undoManger.save();g.appendChild(e.extractContents());g.href=g.innerHTML=g.innerHTML.replace(/<[^>]+>/g,"");l=g.getAttribute("href").replace(RegExp(f.fillChar,"g"),"");l=/^(?:https?:\/\/)/ig.test(l)?l:"http://"+l;g.setAttribute("_src",p.html(l));g.href=p.html(l);e.insertNode(g);g.parentNode.insertBefore(h,g.nextSibling);e.setStart(h,
0);e.collapse(!0);d.removeAllRanges();d.addRange(e);a.undoManger&&a.undoManger.save()}}}})}};UE.plugins.autoheight=function(){function a(){var a=this;clearTimeout(l);k||(l=setTimeout(function(){a.queryCommandState&&1!=a.queryCommandState("source")&&(d||(d=a.document.createElement("span"),d.style.cssText="display:block;width:0;margin:0;padding:0;border:0;clear:both;",d.innerHTML="."),e=d.cloneNode(!0),a.body.appendChild(e),j=Math.max(f.getXY(e).y+e.offsetHeight,Math.max(h.minFrameHeight,h.initialFrameHeight)),
j!=g&&(a.setHeight(j),g=j),f.remove(e))},50))}var b=this;b.autoHeightEnabled=!1!==b.options.autoHeightEnabled;if(b.autoHeightEnabled){var c,d,e,g=0,h=b.options,j,l,k;b.addListener("fullscreenchanged",function(a,b){k=b});b.addListener("destroy",function(){b.removeListener("contentchange",a);b.removeListener("afterinserthtml",a);b.removeListener("keyup",a);b.removeListener("mouseup",a)});b.enableAutoHeight=function(){if(b.autoHeightEnabled){var d=b.document;b.autoHeightEnabled=!0;c=d.body.style.overflowY;
d.body.style.overflowY="hidden";b.addListener("contentchange",a);b.addListener("afterinserthtml",a);b.addListener("keyup",a);b.addListener("mouseup",a);setTimeout(function(){a.call(this)},n.gecko?100:0);b.fireEvent("autoheightchanged",b.autoHeightEnabled)}};b.disableAutoHeight=function(){b.body.style.overflowY=c||"";b.removeListener("contentchange",a);b.removeListener("keyup",a);b.removeListener("mouseup",a);b.autoHeightEnabled=!1;b.fireEvent("autoheightchanged",b.autoHeightEnabled)};b.addListener("ready",
function(){b.enableAutoHeight();var c;f.on(n.ie?b.body:b.document,n.webkit?"dragover":"drop",function(){clearTimeout(c);c=setTimeout(function(){a.call(this)},100)})})}};UE.plugins.autofloat=function(){function a(){t=!0;k.parentNode&&k.parentNode.removeChild(k);m.style.cssText=l}function b(){var b=v(c.container),d=c.options.toolbarTopOffset||0;if(0>b.top&&b.bottom-m.offsetHeight>d){var b=f.getXY(m),d=f.getComputedStyle(m,"position"),g=f.getComputedStyle(m,"left");m.style.width=m.offsetWidth+"px";m.style.zIndex=
1*c.options.zIndex+1;m.parentNode.insertBefore(k,m);h||j&&n.ie?("absolute"!=m.style.position&&(m.style.position="absolute"),m.style.top=(document.body.scrollTop||document.documentElement.scrollTop)-q+e+"px"):(n.ie7Compat&&t&&(t=!1,m.style.left=f.getXY(m).x-document.documentElement.getBoundingClientRect().left+2+"px"),"fixed"!=m.style.position&&(m.style.position="fixed",m.style.top=e+"px",("absolute"==d||"relative"==d)&&parseFloat(g)&&(m.style.left=b.x+"px")))}else a()}var c=this,d=c.getLang();c.setOpt({topOffset:0});
var e=c.options.topOffset;if(!1!==c.options.autoFloatEnabled){var g=UE.ui.uiUtils,h=n.ie&&6>=n.version,j=n.quirks,l,k=document.createElement("div"),m,q,v,t=!0,s=p.defer(function(){b()},n.ie?200:100,!0);c.addListener("destroy",function(){f.un(window,["scroll","resize"],b);c.removeListener("keydown",s)});c.addListener("ready",function(){var e;c.ui?e=1:(alert(d.autofloatMsg),e=0);e&&(v=g.getClientRect,m=c.ui.getDom("toolbarbox"),q=v(m).top,l=m.style.cssText,k.style.height=m.offsetHeight+"px",h&&(e=document.body.style,
e.backgroundImage='url("about:blank")',e.backgroundAttachment="fixed"),f.on(window,["scroll","resize"],b),c.addListener("keydown",s),c.addListener("beforefullscreenchange",function(b,c){c&&a()}),c.addListener("fullscreenchanged",function(a,c){c||b()}),c.addListener("sourcemodechanged",function(){setTimeout(function(){b()},0)}),c.addListener("clearDoc",function(){setTimeout(function(){b()},0)}))})}};UE.plugins.pasteplain=function(){this.setOpt({pasteplain:!1,filterTxtRules:function(){function a(b){b.tagName=
"p";b.setStyle()}return{"-":"script style object iframe embed input select",p:{$:{}},br:{$:{}},div:function(a){for(var b,e=UE.uNode.createElement("p");b=a.firstChild();)"text"==b.type||!UE.dom.dtd.$block[b.tagName]?e.appendChild(b):e.firstChild()?(a.parentNode.insertBefore(e,a),e=UE.uNode.createElement("p")):a.parentNode.insertBefore(b,a);e.firstChild()&&a.parentNode.insertBefore(e,a);a.parentNode.removeChild(a)},ol:function(a){a.parentNode.removeChild(a,!0)},ul:function(a){a.parentNode.removeChild(a,
!0)},dl:function(a){a.parentNode.removeChild(a,!0)},dt:function(a){a.parentNode.removeChild(a,!0)},dd:function(a){a.parentNode.removeChild(a,!0)},li:function(a){a.parentNode.removeChild(a,!0)},caption:a,th:a,tr:a,h1:a,h2:a,h3:a,h4:a,h5:a,h6:a,td:function(a){a.innerText()&&a.parentNode.insertAfter(UE.uNode.createText(" &nbsp; &nbsp;"),a);a.parentNode.removeChild(a,a.innerText())}}}()});var a=this.options.pasteplain;this.commands.pasteplain={queryCommandState:function(){return a?1:0},execCommand:function(){a=
!a|0},notNeedUndo:1}};UE.plugins.video=function(){function a(a,b,f,h,j,l){return!l?"<img "+(h?'id="'+h+'"':"")+' width="'+b+'" height="'+f+'" _url="'+a+'" class="edui-faked-video" src="'+c.options.UEDITOR_HOME_URL+'themes/default/images/spacer.gif" style="background:url('+c.options.UEDITOR_HOME_URL+"themes/default/images/videologo.gif) no-repeat center center; border:1px solid gray;"+(j?"float:"+j+";":"")+'" />':'<embed type="application/x-shockwave-flash" class="edui-faked-video" pluginspage="http://www.macromedia.com/go/getflashplayer" src="'+
a+'" width="'+b+'" height="'+f+'"'+(j?' style="float:'+j+'"':"")+' wmode="transparent" play="true" loop="false" menu="false" allowscriptaccess="never" allowfullscreen="true" >'}function b(b,c){p.each(b.getNodesByTagName(c?"img":"embed"),function(b){if("edui-faked-video"==b.getAttr("class")){var d=a(c?b.getAttr("_url"):b.getAttr("src"),b.getAttr("width"),b.getAttr("height"),null,b.getStyle("float")||"",c);b.parentNode.replaceChild(UE.uNode.createElement(d),b)}})}var c=this;c.addOutputRule(function(a){b(a,
!0)});c.addInputRule(function(a){b(a)});c.commands.insertvideo={execCommand:function(b,e){e=p.isArray(e)?e:[e];for(var g=[],h=0,j,l=e.length;h<l;h++)j=e[h],g.push(a(j.url,j.width||420,j.height||280,"tmpVedio"+h,null,!1));c.execCommand("inserthtml",g.join(""),!0);g=this.selection.getRange();h=0;for(l=e.length;h<l;h++)j=this.document.getElementById("tmpVedio"+h),f.removeAttributes(j,"id"),g.selectNode(j).select(),c.execCommand("imagefloat",e[h].align)},queryCommandState:function(){var a=c.selection.getRange().getClosedNode();
return a&&"edui-faked-video"==a.className?1:0}}};var G=UE.UETable=function(a){this.table=a;this.indexTable=[];this.selectedTds=[];this.cellsRange={};this.update(a)};G.removeSelectedClass=function(a){p.each(a,function(a){f.removeClasses(a,"selectTdClass")})};G.addSelectedClass=function(a){p.each(a,function(a){f.addClass(a,"selectTdClass")})};G.isEmptyBlock=function(a){var b=RegExp(f.fillChar,"g");if(0<a[n.ie?"innerText":"textContent"].replace(/^\s*$/,"").replace(b,"").length)return 0;for(var c in t.$isNotEmpty)if(t.$isNotEmpty.hasOwnProperty(c)&&
a.getElementsByTagName(c).length)return 0;return 1};G.getWidth=function(a){return!a?0:parseInt(f.getComputedStyle(a,"width"),10)};G.getTableCellAlignState=function(a){!p.isArray(a)&&(a=[a]);var b={},c=["align","valign"],d=null,e=!0;p.each(a,function(a){p.each(c,function(c){d=a.getAttribute(c);if(!b[c]&&d)b[c]=d;else if(!b[c]||d!==b[c])return e=!1});return e});return e?b:null};G.getTableItemsByRange=function(a){var b=a.selection.getStart(),c=(a=b&&f.findParentByTagName(b,["td","th"],!0))&&a.parentNode,
b=b&&f.findParentByTagName(b,"caption",!0);return{cell:a,tr:c,table:b?b.parentNode:c&&c.parentNode.parentNode,caption:b}};G.getUETableBySelected=function(a){return(a=G.getTableItemsByRange(a).table)&&a.ueTable&&a.ueTable.selectedTds.length?a.ueTable:null};G.getDefaultValue=function(a,b){var c={thin:"0px",medium:"1px",thick:"2px"},d,e,g;if(b)h=b.getElementsByTagName("td")[0],g=f.getComputedStyle(b,"border-left-width"),d=parseInt(c[g]||g,10),g=f.getComputedStyle(h,"padding-left"),e=parseInt(c[g]||g,
10),g=f.getComputedStyle(h,"border-left-width"),c=parseInt(c[g]||g,10);else{b=a.document.createElement("table");b.insertRow(0).insertCell(0).innerHTML="xxx";a.body.appendChild(b);var h=b.getElementsByTagName("td")[0];g=f.getComputedStyle(b,"border-left-width");d=parseInt(c[g]||g,10);g=f.getComputedStyle(h,"padding-left");e=parseInt(c[g]||g,10);g=f.getComputedStyle(h,"border-left-width");c=parseInt(c[g]||g,10);f.remove(b)}return{tableBorder:d,tdPadding:e,tdBorder:c}};G.getUETable=function(a){var b=
a.tagName.toLowerCase();a="td"==b||"th"==b||"caption"==b?f.findParentByTagName(a,"table",!0):a;a.ueTable||(a.ueTable=new G(a));return a.ueTable};G.cloneCell=function(a,b,c){if(!a||p.isString(a))return this.table.ownerDocument.createElement(a||"td");var d=f.hasClass(a,"selectTdClass");d&&f.removeClasses(a,"selectTdClass");var e=a.cloneNode(!0);b&&(e.rowSpan=e.colSpan=1);e.style.borderLeftStyle="";e.style.borderTopStyle="";e.style.borderLeftColor=a.style.borderRightColor;e.style.borderLeftWidth=a.style.borderRightWidth;
e.style.borderTopColor=a.style.borderBottomColor;e.style.borderTopWidth=a.style.borderBottomWidth;d&&f.addClass(a,"selectTdClass");c&&f.removeAttributes(e,"width height");return e};G.prototype={getMaxRows:function(){for(var a=this.table.rows,b=1,c=0,d;d=a[c];c++){for(var e=1,f=0,h;h=d.cells[f++];)e=Math.max(h.rowSpan||1,e);b=Math.max(e+c,b)}return b},getMaxCols:function(){for(var a=this.table.rows,b=0,c={},d=0,e;e=a[d];d++){for(var f=0,h=0,j;j=e.cells[h++];)if(f+=j.colSpan||1,j.rowSpan&&1<j.rowSpan)for(var l=
1;l<j.rowSpan;l++)c["row_"+(d+l)]?c["row_"+(d+l)]++:c["row_"+(d+l)]=j.colSpan||1;f+=c["row_"+d]||0;b=Math.max(f,b)}return b},getCellColIndex:function(){},getHSideCell:function(a,b){try{var c=this.getCellInfo(a),d,e,f=this.selectedTds.length,h=this.cellsRange;if(!b&&(!f?!c.colIndex:!h.beginColIndex)||b&&(!f?c.colIndex==this.colsNum-1:h.endColIndex==this.colsNum-1))return null;d=!f?c.rowIndex:h.beginRowIndex;e=!b?!f?1>c.colIndex?0:c.colIndex-1:h.beginColIndex-1:!f?c.colIndex+1:h.endColIndex+1;return this.getCell(this.indexTable[d][e].rowIndex,
this.indexTable[d][e].cellIndex)}catch(j){}},getTabNextCell:function(a,b){var c=this.getCellInfo(a),d=b||c.rowIndex,c=c.colIndex+1+(c.colSpan-1),e;try{e=this.getCell(this.indexTable[d][c].rowIndex,this.indexTable[d][c].cellIndex)}catch(f){try{d=1*d+1,c=0,e=this.getCell(this.indexTable[d][c].rowIndex,this.indexTable[d][c].cellIndex)}catch(h){}}return e},getVSideCell:function(a,b,c){try{var d=this.getCellInfo(a),e,f,h=this.selectedTds.length&&!c,j=this.cellsRange;if(!b&&0==d.rowIndex||b&&(!h?d.rowIndex+
d.rowSpan>this.rowsNum-1:j.endRowIndex==this.rowsNum-1))return null;e=!b?!h?d.rowIndex-1:j.beginRowIndex-1:!h?d.rowIndex+d.rowSpan:j.endRowIndex+1;f=!h?d.colIndex:j.beginColIndex;return this.getCell(this.indexTable[e][f].rowIndex,this.indexTable[e][f].cellIndex)}catch(l){}},getSameEndPosCells:function(a,b){try{for(var c="x"===b.toLowerCase(),d=f.getXY(a)[c?"x":"y"]+a["offset"+(c?"Width":"Height")],e=this.table.rows,g=null,h=[],j=0;j<this.rowsNum;j++)for(var g=e[j].cells,l=0,k;k=g[l++];){var m=f.getXY(k)[c?
"x":"y"]+k["offset"+(c?"Width":"Height")];if(m>d&&c)break;if(a==k||d==m)if(1==k[c?"colSpan":"rowSpan"]&&h.push(k),c)break}return h}catch(n){}},setCellContent:function(a,b){a.innerHTML=b||(n.ie?f.fillChar:"<br />")},cloneCell:G.cloneCell,getSameStartPosXCells:function(a){try{var b=f.getXY(a).x+a.offsetWidth,c=this.table.rows,d;a=[];for(var e=0;e<this.rowsNum;e++){d=c[e].cells;for(var g=0,h;h=d[g++];){var j=f.getXY(h).x;if(j>b)break;if(j==b&&1==h.colSpan){a.push(h);break}}}return a}catch(l){}},update:function(a){this.table=
a||this.table;this.selectedTds=[];this.cellsRange={};this.indexTable=[];a=this.table.rows;for(var b=this.getMaxRows(),c=b-a.length,d=this.getMaxCols();c--;)this.table.insertRow(a.length);this.rowsNum=b;this.colsNum=d;for(var c=0,e=a.length;c<e;c++)this.indexTable[c]=Array(d);for(var c=0,g;g=a[c];c++){var e=0,h;for(g=g.cells;h=g[e];e++){h.rowSpan>b&&(h.rowSpan=b);var j=e,l=h.rowSpan||1;for(h=h.colSpan||1;this.indexTable[c][j];)j++;for(var k=0;k<l;k++)for(var m=0;m<h;m++)this.indexTable[c+k][j+m]={rowIndex:c,
cellIndex:e,colIndex:j,rowSpan:l,colSpan:h}}}for(k=0;k<b;k++)for(m=0;m<d;m++)void 0===this.indexTable[k][m]&&(g=a[k],h=(h=g.cells[g.cells.length-1])?h.cloneNode(!0):this.table.ownerDocument.createElement("td"),this.setCellContent(h),1!==h.colSpan&&(h.colSpan=1),1!==h.rowSpan&&(h.rowSpan=1),g.appendChild(h),this.indexTable[k][m]={rowIndex:k,cellIndex:h.cellIndex,colIndex:m,rowSpan:1,colSpan:1});a=f.getElementsByTagName(this.table,"td");var n=[];p.each(a,function(a){f.hasClass(a,"selectTdClass")&&n.push(a)});
n.length&&(b=n[n.length-1],a=this.getCellInfo(n[0]),b=this.getCellInfo(b),this.selectedTds=n,this.cellsRange={beginRowIndex:a.rowIndex,beginColIndex:a.colIndex,endRowIndex:b.rowIndex+b.rowSpan-1,endColIndex:b.colIndex+b.colSpan-1})},getCellInfo:function(a){if(a){var b=a.cellIndex;a=a.parentNode.rowIndex;for(var c=this.indexTable[a],d=this.colsNum,e=b;e<d;e++){var f=c[e];if(f.rowIndex===a&&f.cellIndex===b)return f}}},getCell:function(a,b){return a<this.rowsNum&&this.table.rows[a].cells[b]||null},deleteCell:function(a,
b){b="number"==typeof b?b:a.parentNode.rowIndex;this.table.rows[b].deleteCell(a.cellIndex)},getCellsRange:function(a,b){function c(a,b,e,f){var g=a,h=b,j=e,l=f,k,m,n;if(0<a)for(m=b;m<f;m++)k=d.indexTable[a][m],n=k.rowIndex,n<a&&(g=Math.min(n,g));if(f<d.colsNum)for(n=a;n<e;n++)k=d.indexTable[n][f],m=k.colIndex+k.colSpan-1,m>f&&(l=Math.max(m,l));if(e<d.rowsNum)for(m=b;m<f;m++)k=d.indexTable[e][m],n=k.rowIndex+k.rowSpan-1,n>e&&(j=Math.max(n,j));if(0<b)for(n=a;n<e;n++)k=d.indexTable[n][b],m=k.colIndex,
m<b&&(h=Math.min(k.colIndex,h));return g!=a||h!=b||j!=e||l!=f?c(g,h,j,l):{beginRowIndex:a,beginColIndex:b,endRowIndex:e,endColIndex:f}}try{var d=this,e=d.getCellInfo(a);if(a===b)return{beginRowIndex:e.rowIndex,beginColIndex:e.colIndex,endRowIndex:e.rowIndex+e.rowSpan-1,endColIndex:e.colIndex+e.colSpan-1};var f=d.getCellInfo(b),h=Math.min(e.rowIndex,f.rowIndex),j=Math.min(e.colIndex,f.colIndex),l=Math.max(e.rowIndex+e.rowSpan-1,f.rowIndex+f.rowSpan-1),k=Math.max(e.colIndex+e.colSpan-1,f.colIndex+f.colSpan-
1);return c(h,j,l,k)}catch(m){if(debug)throw m;}},getCells:function(a){this.clearSelected();for(var b=a.beginColIndex,c=a.endRowIndex,d=a.endColIndex,e,f,h={},j=[],l=a.beginRowIndex;l<=c;l++)for(var k=b;k<=d;k++){a=this.indexTable[l][k];e=a.rowIndex;f=a.colIndex;var m=e+"|"+f;if(!h[m]){h[m]=1;if(e<l||f<k||e+a.rowSpan-1>c||f+a.colSpan-1>d)return null;j.push(this.getCell(e,a.cellIndex))}}return j},clearSelected:function(){G.removeSelectedClass(this.selectedTds);this.selectedTds=[];this.cellsRange={}},
setSelected:function(a){var b=this.getCells(a);G.addSelectedClass(b);this.selectedTds=b;this.cellsRange=a},isFullRow:function(){var a=this.cellsRange;return a.endColIndex-a.beginColIndex+1==this.colsNum},isFullCol:function(){var a=this.cellsRange,b=this.table.getElementsByTagName("th"),a=a.endRowIndex-a.beginRowIndex+1;return!b.length?a==this.rowsNum:a==this.rowsNum||a==this.rowsNum-1},getNextCell:function(a,b,c){try{var d=this.getCellInfo(a),e,f,h=this.selectedTds.length&&!c,j=this.cellsRange;if(!b&&
0==d.rowIndex||b&&(!h?d.rowIndex+d.rowSpan>this.rowsNum-1:j.endRowIndex==this.rowsNum-1))return null;e=!b?!h?d.rowIndex-1:j.beginRowIndex-1:!h?d.rowIndex+d.rowSpan:j.endRowIndex+1;f=!h?d.colIndex:j.beginColIndex;return this.getCell(this.indexTable[e][f].rowIndex,this.indexTable[e][f].cellIndex)}catch(l){}},getPreviewCell:function(a,b){try{var c=this.getCellInfo(a),d,e,f=this.selectedTds.length,h=this.cellsRange;if(!b&&(!f?!c.colIndex:!h.beginColIndex)||b&&(!f?c.rowIndex>this.colsNum-1:h.endColIndex==
this.colsNum-1))return null;d=!b?!f?c.rowIndex:h.beginRowIndex:!f?1>c.rowIndex?0:c.rowIndex-1:h.beginRowIndex;e=!b?!f?1>c.colIndex?0:c.colIndex-1:h.beginColIndex-1:!f?c.colIndex:h.endColIndex+1;return this.getCell(this.indexTable[d][e].rowIndex,this.indexTable[d][e].cellIndex)}catch(j){}},moveContent:function(a,b){if(!G.isEmptyBlock(b))if(G.isEmptyBlock(a))a.innerHTML=b.innerHTML;else{var c=a.lastChild;for((3==c.nodeType||!t.$block[c.tagName])&&a.appendChild(a.ownerDocument.createElement("br"));c=
b.firstChild;)a.appendChild(c)}},mergeRight:function(a){var b=this.getCellInfo(a),c=this.indexTable[b.rowIndex][b.colIndex+b.colSpan],d=this.getCell(c.rowIndex,c.cellIndex);a.colSpan=b.colSpan+c.colSpan;a.removeAttribute("width");this.moveContent(a,d);this.deleteCell(d,c.rowIndex);this.update()},mergeDown:function(a){var b=this.getCellInfo(a),c=this.indexTable[b.rowIndex+b.rowSpan][b.colIndex],d=this.getCell(c.rowIndex,c.cellIndex);a.rowSpan=b.rowSpan+c.rowSpan;a.removeAttribute("height");this.moveContent(a,
d);this.deleteCell(d,c.rowIndex);this.update()},mergeRange:function(){var a=this.cellsRange,b=this.getCell(a.beginRowIndex,this.indexTable[a.beginRowIndex][a.beginColIndex].cellIndex);if("TH"==b.tagName&&a.endRowIndex!==a.beginRowIndex)var c=this.indexTable,a=this.getCellInfo(b),b=this.getCell(1,c[1][a.colIndex].cellIndex),a=this.getCellsRange(b,this.getCell(c[this.rowsNum-1][a.colIndex].rowIndex,c[this.rowsNum-1][a.colIndex].cellIndex));for(var d=this.getCells(a),c=0,e;e=d[c++];)e!==b&&(this.moveContent(b,
e),this.deleteCell(e));b.rowSpan=a.endRowIndex-a.beginRowIndex+1;1<b.rowSpan&&b.removeAttribute("height");b.colSpan=a.endColIndex-a.beginColIndex+1;1<b.colSpan&&b.removeAttribute("width");b.rowSpan==this.rowsNum&&1!=b.colSpan&&(b.colSpan=1);if(b.colSpan==this.colsNum&&1!=b.rowSpan){d=b.parentNode.rowIndex;if(this.table.deleteRow){c=d+1;d+=1;for(a=b.rowSpan;c<a;c++)this.table.deleteRow(d)}else{c=0;for(a=b.rowSpan-1;c<a;c++)e=this.table.rows[d+1],e.parentNode.removeChild(e)}b.rowSpan=1}this.update()},
insertRow:function(a,b){var c=this.colsNum,d=this.table,e=d.insertRow(a);parseInt((d.offsetWidth-20*c-c-1)/c,10);if(0==a||a==this.rowsNum)for(var f=0;f<c;f++)d=this.cloneCell(b,!0,!0),this.setCellContent(d),d.getAttribute("vAlign")&&d.setAttribute("vAlign",d.getAttribute("vAlign")),e.appendChild(d);else for(var h=this.indexTable[a],f=0;f<c;f++){var j=h[f];j.rowIndex<a?(d=this.getCell(j.rowIndex,j.cellIndex),d.rowSpan=j.rowSpan+1):(d=this.cloneCell(b,!0,!0),this.setCellContent(d),e.appendChild(d))}this.update();
return e},deleteRow:function(a){for(var b=this.table.rows[a],c=this.indexTable[a],d=this.colsNum,e=0,g=0;g<d;){var h=c[g],j=this.getCell(h.rowIndex,h.cellIndex);if(1<j.rowSpan&&h.rowIndex==a){h=j.cloneNode(!0);h.rowSpan=j.rowSpan-1;h.innerHTML="";j.rowSpan=1;var l=a+1,k=this.table.rows[l],l=this.getPreviewMergedCellsNum(l,g)-e;l<g?(l=g-l-1,f.insertAfter(k.cells[l],h)):k.cells.length&&k.insertBefore(h,k.cells[0]);e+=1}g+=j.colSpan||1}a=[];e={};for(g=0;g<d;g++)j=c[g].rowIndex,h=c[g].cellIndex,k=j+"_"+
h,e[k]||(e[k]=1,j=this.getCell(j,h),a.push(j));var m=[];p.each(a,function(a){1==a.rowSpan?a.parentNode.removeChild(a):m.push(a)});p.each(m,function(a){a.rowSpan--});b.parentNode.removeChild(b);this.update()},insertCol:function(a,b,c){function d(a,b,c){0==a?(a=b.nextSibling||b.previousSibling,"TH"==a.tagName&&(a=b.ownerDocument.createElement("th"),a.appendChild(b.firstChild),c.insertBefore(a,b),f.remove(b))):"TH"==b.tagName&&(a=b.ownerDocument.createElement("td"),a.appendChild(b.firstChild),c.insertBefore(a,
b),f.remove(b))}var e=this.rowsNum,g=0,h,j,l=parseInt((this.table.offsetWidth-20*(this.colsNum+1)-(this.colsNum+1))/(this.colsNum+1),10),k;if(0==a||a==this.colsNum)for(;g<e;g++)h=this.table.rows[g],k=h.cells[0==a?a:h.cells.length],j=this.cloneCell(b,!0),this.setCellContent(j),j.setAttribute("vAlign",j.getAttribute("vAlign")),k&&j.setAttribute("width",k.getAttribute("width")),a?f.insertAfter(h.cells[h.cells.length-1],j):h.insertBefore(j,h.cells[0]),d(g,j,h);else for(;g<e;g++)k=this.indexTable[g][a],
k.colIndex<a?(j=this.getCell(k.rowIndex,k.cellIndex),j.colSpan=k.colSpan+1):(h=this.table.rows[g],k=h.cells[k.cellIndex],j=this.cloneCell(b,!0),this.setCellContent(j),j.setAttribute("vAlign",j.getAttribute("vAlign")),k&&j.setAttribute("width",k.getAttribute("width")),h.insertBefore(j,k)),d(g,j,h);this.update();this.updateWidth(l,c||{tdPadding:10,tdBorder:1})},updateWidth:function(a,b){var c=this.table,d=G.getWidth(c)-2*b.tdPadding-b.tdBorder+a;d<c.ownerDocument.body.offsetWidth?c.setAttribute("width",
d):(c=f.getElementsByTagName(this.table,"td"),p.each(c,function(b){b.setAttribute("width",a)}))},deleteCol:function(a){for(var b=this.indexTable,c=this.table.rows,d=this.table.getAttribute("width"),e=0,f=this.rowsNum,h={},j=0;j<f;){var l=b[j][a],k=l.rowIndex+"_"+l.colIndex;h[k]||(h[k]=1,k=this.getCell(l.rowIndex,l.cellIndex),e||(e=k&&parseInt(k.offsetWidth/k.colSpan,10).toFixed(0)),1<k.colSpan?k.colSpan--:c[j].deleteCell(l.cellIndex),j+=l.rowSpan||1)}this.table.setAttribute("width",d-e);this.update()},
splitToCells:function(a){var b=this;a=this.splitToRows(a);p.each(a,function(a){b.splitToCols(a)})},splitToRows:function(a){var b=this.getCellInfo(a),c=b.rowIndex,d=b.colIndex,e=[];a.rowSpan=1;e.push(a);for(var f=c,h=c+b.rowSpan;f<h;f++)if(f!=c){var j=this.table.rows[f].insertCell(d-this.getPreviewMergedCellsNum(f,d));j.colSpan=b.colSpan;this.setCellContent(j);j.setAttribute("vAlign",a.getAttribute("vAlign"));j.setAttribute("align",a.getAttribute("align"));a.style.cssText&&(j.style.cssText=a.style.cssText);
e.push(j)}this.update();return e},getPreviewMergedCellsNum:function(a,b){for(var c=this.indexTable[a],d=0,e=0;e<b;)var f=c[e].colSpan,d=d+(f-(c[e].rowIndex==a?1:0)),e=e+f;return d},splitToCols:function(a){var b=(a.offsetWidth/a.colSpan-22).toFixed(0),c=this.getCellInfo(a),d=c.rowIndex,e=c.colIndex,g=[];a.colSpan=1;a.setAttribute("width",b);g.push(a);for(var h=e,j=e+c.colSpan;h<j;h++)if(h!=e){var l=this.table.rows[d],k=l.insertCell(this.indexTable[d][h].cellIndex+1);k.rowSpan=c.rowSpan;this.setCellContent(k);
k.setAttribute("vAlign",a.getAttribute("vAlign"));k.setAttribute("align",a.getAttribute("align"));k.setAttribute("width",b);a.style.cssText&&(k.style.cssText=a.style.cssText);if("TH"==a.tagName){var m=a.ownerDocument.createElement("th");m.appendChild(k.firstChild);m.setAttribute("vAlign",a.getAttribute("vAlign"));m.rowSpan=k.rowSpan;l.insertBefore(m,k);f.remove(k)}g.push(k)}this.update();return g},isLastCell:function(a,b,c){b=b||this.rowsNum;c=c||this.colsNum;a=this.getCellInfo(a);return a.rowIndex+
a.rowSpan==b&&a.colIndex+a.colSpan==c},getLastCell:function(a){a=a||this.table.getElementsByTagName("td");this.getCellInfo(a[0]);var b=this,c=a[0],d=c.parentNode,e=0,f=0,h;p.each(a,function(a){a.parentNode==d&&(f+=a.colSpan||1);e+=a.rowSpan*a.colSpan||1});h=e/f;p.each(a,function(a){if(b.isLastCell(a,h,f))return c=a,!1});return c},selectRow:function(a){var b=this.indexTable[a];a=this.getCell(b[0].rowIndex,b[0].cellIndex);b=this.getCell(b[this.colsNum-1].rowIndex,b[this.colsNum-1].cellIndex);a=this.getCellsRange(a,
b);this.setSelected(a)},selectTable:function(){var a=this.table.getElementsByTagName("td"),a=this.getCellsRange(a[0],a[a.length-1]);this.setSelected(a)},sortTable:function(a,b){var c=this.table,d=c.rows,e=[],f="TH"===d[0].cells[0].tagName,h=0;if(this.selectedTds.length){for(var j=this.cellsRange,l=j.endRowIndex+1,k=j.beginRowIndex;k<l;k++)e[k]=d[k];e.splice(0,j.beginRowIndex);h=j.endRowIndex+1===this.rowsNum?0:j.endRowIndex+1}else{k=0;for(l=d.length;k<l;k++)e[k]=d[k]}f&&e.splice(0,1);e=p.sort(e,function(c,
d){return b?"number"===typeof b?b:b.call(this,c.cells[a],d.cells[a]):(c.cells[a].innerText||c.cells[a].textContent).localeCompare(d.cells[a].innerText||d.cells[a].textContent)});f=c.ownerDocument.createDocumentFragment();k=0;for(l=e.length;k<l;k++)f.appendChild(e[k]);c=c.getElementsByTagName("tbody")[0];h?c.insertBefore(f,d[h-j.endRowIndex+j.beginRowIndex-1]):c.appendChild(f)},setBackground:function(a,b){if("string"===typeof b)p.each(a,function(a){a.style.backgroundColor=b});else if("object"===typeof b){b=
p.extend({repeat:!0,colorList:["#ddd","#fff"]},b);for(var c=this.getCellInfo(a[0]).rowIndex,d=0,e=b.colorList,f=0,h;h=a[f++];){var j=this.getCellInfo(h);h=h.style;j=c+d==j.rowIndex?d:++d;h.backgroundColor=e[j]?e[j]:b.repeat?e[j%e.length]:""}}},removeBackground:function(a){p.each(a,function(a){a.style.backgroundColor=""})}};var Kb=function(a,b,c){var d=a.body;return d.offsetWidth-(b?2*parseInt(f.getComputedStyle(d,"margin-left"),10):0)-2*c.tableBorder-(a.options.offsetWidth||0)},P=function(a){if(a=
w(a).cell){var b=F(a);return b.selectedTds.length?b.selectedTds:[a]}return[]},O=UE.UETable,w=function(a){return O.getTableItemsByRange(a)},F=function(a){return O.getUETable(a)};UE.commands.inserttable={queryCommandState:function(){return w(this).table?-1:0},execCommand:function(a,b){b||(b=p.extend({},{numCols:this.options.defaultCols,numRows:this.options.defaultRows,tdvalign:this.options.tdvalign}));var c=this.selection.getRange().startContainer,d=f.findParent(c,function(a){return f.isBlockElm(a)},
!0),c=O.getDefaultValue(this,void 0),d=Kb(this,!0,c)-(d?parseInt(f.getXY(d).x,10):0),c=Math.floor(d/b.numCols-2*c.tdPadding-c.tdBorder);!b.tdvalign&&(b.tdvalign=this.options.tdvalign);this.execCommand("inserthtml",function(a,b,c){for(var d=[],l=a.numRows,k=a.numCols,m=0;m<l;m++){d.push("<tr>");for(var p=0;p<k;p++)d.push('<td width="'+c+'"  vAlign="'+a.tdvalign+'" >'+(n.ie?f.fillChar:"<br/>")+"</td>");d.push("</tr>")}return'<table width="'+b+'"   ><tbody>'+d.join("")+"</tbody></table>"}(b,d,c))}};
UE.commands.insertparagraphbeforetable={queryCommandState:function(){return w(this).cell?0:-1},execCommand:function(){var a=w(this).table;if(a){var b=this.document.createElement("p");b.innerHTML=n.ie?"&nbsp;":"<br />";a.parentNode.insertBefore(b,a);this.selection.getRange().setStart(b,0).setCursor()}}};UE.commands.deletetable={queryCommandState:function(){var a=this.selection.getRange();return f.findParentByTagName(a.startContainer,"table",!0)?0:-1},execCommand:function(a,b){var c=this.selection.getRange();
if(b=b||f.findParentByTagName(c.startContainer,"table",!0)){var d=b.nextSibling;d||(d=f.createElement(this.document,"p",{innerHTML:n.ie?f.fillChar:"<br/>"}),b.parentNode.insertBefore(d,b));f.remove(b);c=this.selection.getRange();3==d.nodeType?c.setStartBefore(d):c.setStart(d,0);c.setCursor(!1,!0);this.fireEvent("tablehasdeleted")}}};UE.commands.cellalign={queryCommandState:function(){return P(this).length?0:-1},execCommand:function(a,b){var c=P(this);if(c.length)for(var d=0,e;e=c[d++];)e.setAttribute("align",
b)}};UE.commands.cellvalign={queryCommandState:function(){return P(this).length?0:-1},execCommand:function(a,b){var c=P(this);if(c.length)for(var d=0,e;e=c[d++];)e.setAttribute("vAlign",b)}};UE.commands.insertcaption={queryCommandState:function(){var a=w(this).table;return a?0==a.getElementsByTagName("caption").length?1:-1:-1},execCommand:function(){var a=w(this).table;if(a){var b=this.document.createElement("caption");b.innerHTML=n.ie?f.fillChar:"<br/>";a.insertBefore(b,a.firstChild);this.selection.getRange().setStart(b,
0).setCursor()}}};UE.commands.deletecaption={queryCommandState:function(){var a=this.selection.getRange();return(a=f.findParentByTagName(a.startContainer,"table"))?0==a.getElementsByTagName("caption").length?-1:1:-1},execCommand:function(){var a=this.selection.getRange();if(a=f.findParentByTagName(a.startContainer,"table"))f.remove(a.getElementsByTagName("caption")[0]),this.selection.getRange().setStart(a.rows[0].cells[0],0).setCursor()}};UE.commands.inserttitle={queryCommandState:function(){var a=
w(this).table;return a?0==a.rows[0].getElementsByTagName("th").length?0:-1:-1},execCommand:function(){var a=w(this).table;a&&F(a).insertRow(0,"th");a=a.getElementsByTagName("th")[0];this.selection.getRange().setStart(a,0).setCursor(!1,!0)}};UE.commands.deletetitle={queryCommandState:function(){var a=w(this).table;return a?a.rows[0].getElementsByTagName("th").length?0:-1:-1},execCommand:function(){var a=w(this).table;a&&f.remove(a.rows[0]);a=a.getElementsByTagName("td")[0];this.selection.getRange().setStart(a,
0).setCursor(!1,!0)}};UE.commands.mergeright={queryCommandState:function(){var a=w(this);if(!a.cell)return-1;var b=F(a.table);if(b.selectedTds.length)return-1;var a=b.getCellInfo(a.cell),c=a.colIndex+a.colSpan;if(c>=b.colsNum)return-1;b=b.indexTable[a.rowIndex][c];return b.rowIndex==a.rowIndex&&b.rowSpan==a.rowSpan?0:-1},execCommand:function(){var a=this.selection.getRange(),b=a.createBookmark(!0),c=w(this).cell;F(c).mergeRight(c);a.moveToBookmark(b).select()}};UE.commands.mergedown={queryCommandState:function(){var a=
w(this),b=a.cell;if(!b||"TH"==b.tagName)return-1;var c=F(a.table);if(c.selectedTds.length)return-1;var b=c.getCellInfo(a.cell),d=b.rowIndex+b.rowSpan;if(d>=c.rowsNum)return-1;c=c.indexTable[d][b.colIndex];return c.colIndex==b.colIndex&&c.colSpan==b.colSpan&&"TH"!==a.cell.tagName?0:-1},execCommand:function(){var a=this.selection.getRange(),b=a.createBookmark(!0),c=w(this).cell;F(c).mergeDown(c);a.moveToBookmark(b).select()}};UE.commands.mergecells={queryCommandState:function(){return O.getUETableBySelected(this)?
0:-1},execCommand:function(){var a=O.getUETableBySelected(this);if(a&&a.selectedTds.length){var b=a.selectedTds[0];a.mergeRange();a=this.selection.getRange();f.isEmptyBlock(b)?a.setStart(b,0).collapse(!0):a.selectNodeContents(b);a.select()}}};UE.commands.insertrow={queryCommandState:function(){var a=w(this),b=a.cell;return b&&"TD"==b.tagName&&F(a.table).rowsNum<this.options.maxRowNum?0:-1},execCommand:function(){var a=this.selection.getRange(),b=a.createBookmark(!0),c=w(this),d=c.cell,c=c.table,e=
F(c),f=e.getCellInfo(d);if(e.selectedTds.length)for(var f=e.cellsRange,h=0,j=f.endRowIndex-f.beginRowIndex+1;h<j;h++)e.insertRow(f.beginRowIndex,d);else e.insertRow(f.rowIndex,d);a.moveToBookmark(b).select();"enabled"===c.getAttribute("interlaced")&&this.fireEvent("interlacetable",c)}};UE.commands.insertrownext={queryCommandState:function(){var a=w(this),b=a.cell;return b&&"TD"==b.tagName&&F(a.table).rowsNum<this.options.maxRowNum?0:-1},execCommand:function(){var a=this.selection.getRange(),b=a.createBookmark(!0),
c=w(this),d=c.cell,c=c.table,e=F(c),f=e.getCellInfo(d);if(e.selectedTds.length)for(var f=e.cellsRange,h=0,j=f.endRowIndex-f.beginRowIndex+1;h<j;h++)e.insertRow(f.endRowIndex+1,d);else e.insertRow(f.rowIndex+f.rowSpan,d);a.moveToBookmark(b).select();"enabled"===c.getAttribute("interlaced")&&this.fireEvent("interlacetable",c)}};UE.commands.deleterow={queryCommandState:function(){if(!w(this).cell)return-1},execCommand:function(){var a=w(this).cell,b=F(a),c=b.cellsRange,d=b.getCellInfo(a),e=b.getVSideCell(a),
g=b.getVSideCell(a,!0),a=this.selection.getRange();if(p.isEmptyObject(c))b.deleteRow(d.rowIndex);else for(var h=c.beginRowIndex;h<c.endRowIndex+1;h++)b.deleteRow(c.beginRowIndex);h=b.table;if(h.getElementsByTagName("td").length)if(1==d.rowSpan||d.rowSpan==c.endRowIndex-c.beginRowIndex+1){if(g||e)a.selectNodeContents(g||e).setCursor(!1,!0)}else(b=b.getCell(d.rowIndex,b.indexTable[d.rowIndex][d.colIndex].cellIndex))&&a.selectNodeContents(b).setCursor(!1,!0);else b=h.nextSibling,f.remove(h),b&&a.setStart(b,
0).setCursor(!1,!0);"enabled"===h.getAttribute("interlaced")&&this.fireEvent("interlacetable",h)}};UE.commands.insertcol={queryCommandState:function(){var a=w(this),b=a.cell;return b&&("TD"==b.tagName||"TH"==b.tagName)&&F(a.table).colsNum<this.options.maxColNum?0:-1},execCommand:function(a){var b=this.selection.getRange(),c=b.createBookmark(!0);if(-1!=this.queryCommandState(a)){a=w(this).cell;var d=F(a),e=d.getCellInfo(a);if(d.selectedTds.length)for(var e=d.cellsRange,f=0,h=e.endColIndex-e.beginColIndex+
1;f<h;f++)d.insertCol(e.beginColIndex,a);else d.insertCol(e.colIndex,a);b.moveToBookmark(c).select(!0)}}};UE.commands.insertcolnext={queryCommandState:function(){var a=w(this);return a.cell&&F(a.table).colsNum<this.options.maxColNum?0:-1},execCommand:function(){var a=this.selection.getRange(),b=a.createBookmark(!0),c=w(this).cell,d=F(c),e=d.getCellInfo(c);if(d.selectedTds.length)for(var e=d.cellsRange,f=0,h=e.endColIndex-e.beginColIndex+1;f<h;f++)d.insertCol(e.endColIndex+1,c);else d.insertCol(e.colIndex+
e.colSpan,c);a.moveToBookmark(b).select()}};UE.commands.deletecol={queryCommandState:function(){if(!w(this).cell)return-1},execCommand:function(){var a=w(this).cell,b=F(a),c=b.cellsRange,d=b.getCellInfo(a),e=b.getHSideCell(a),g=b.getHSideCell(a,!0);if(p.isEmptyObject(c))b.deleteCol(d.colIndex);else for(d=c.beginColIndex;d<c.endColIndex+1;d++)b.deleteCol(c.beginColIndex);b=b.table;c=this.selection.getRange();b.getElementsByTagName("td").length?f.inDoc(a,this.document)?c.setStart(a,0).setCursor(!1,
!0):g&&f.inDoc(g,this.document)?c.selectNodeContents(g).setCursor(!1,!0):e&&f.inDoc(e,this.document)&&c.selectNodeContents(e).setCursor(!0,!0):(a=b.nextSibling,f.remove(b),a&&c.setStart(a,0).setCursor(!1,!0))}};UE.commands.splittocells={queryCommandState:function(){var a=w(this),b=a.cell;return!b||0<F(a.table).selectedTds.length?-1:b&&(1<b.colSpan||1<b.rowSpan)?0:-1},execCommand:function(){var a=this.selection.getRange(),b=a.createBookmark(!0),c=w(this).cell;F(c).splitToCells(c);a.moveToBookmark(b).select()}};
UE.commands.splittorows={queryCommandState:function(){var a=w(this),b=a.cell;return!b||0<F(a.table).selectedTds.length?-1:b&&1<b.rowSpan?0:-1},execCommand:function(){var a=this.selection.getRange(),b=a.createBookmark(!0),c=w(this).cell;F(c).splitToRows(c);a.moveToBookmark(b).select()}};UE.commands.splittocols={queryCommandState:function(){var a=w(this),b=a.cell;return!b||0<F(a.table).selectedTds.length?-1:b&&1<b.colSpan?0:-1},execCommand:function(){var a=this.selection.getRange(),b=a.createBookmark(!0),
c=w(this).cell;F(c).splitToCols(c);a.moveToBookmark(b).select()}};UE.commands.adaptbytext=UE.commands.adaptbywindow={queryCommandState:function(){return w(this).table?0:-1},execCommand:function(a){var b=w(this).table;if(b)if("adaptbywindow"==a){var c=b.getElementsByTagName("td");p.each(c,function(a){a.removeAttribute("width")});b.setAttribute("width",Kb(this,!0,O.getDefaultValue(this,b)));setTimeout(function(){p.each(c,function(a){1==a.colSpan&&a.setAttribute("width",a.offsetWidth+"")})},0)}else a=
f.getElementsByTagName(b,"td th"),p.each(a,function(a){a.removeAttribute("width")}),b.removeAttribute("width")}};UE.commands.averagedistributecol={queryCommandState:function(){var a=O.getUETableBySelected(this);return!a?-1:a.isFullRow()||a.isFullCol()?0:-1},execCommand:function(){var a=O.getUETableBySelected(this);if(a&&a.selectedTds.length){var b=a.table,c=0,d=0,e=O.getDefaultValue(this,b);if(a.isFullRow())c=b.offsetWidth,d=a.colsNum;else for(var b=a.cellsRange.endColIndex,g,h=a.cellsRange.beginColIndex;h<=
b;)g=a.selectedTds[h],c+=g.offsetWidth,h+=g.colSpan,d+=1;var j=Math.ceil(c/d)-2*e.tdBorder-2*e.tdPadding;p.each(f.getElementsByTagName(a.table,"th"),function(a){a.setAttribute("width","")});a=a.isFullRow()?f.getElementsByTagName(a.table,"td"):a.selectedTds;p.each(a,function(a){1==a.colSpan&&a.setAttribute("width",j)})}}};UE.commands.averagedistributerow={queryCommandState:function(){var a=O.getUETableBySelected(this);return!a||a.selectedTds&&/th/ig.test(a.selectedTds[0].tagName)?-1:a.isFullRow()||
a.isFullCol()?0:-1},execCommand:function(){var a=O.getUETableBySelected(this);if(a&&a.selectedTds.length){var b,c=0;b=a.table;var d=O.getDefaultValue(this,b),e=parseInt(f.getComputedStyle(b.getElementsByTagName("td")[0],"padding-top"));if(a.isFullCol()){var c=f.getElementsByTagName(b,"caption"),g=f.getElementsByTagName(b,"th"),h,j;0<c.length&&(h=c[0].offsetHeight);0<g.length&&(j=g[0].offsetHeight);c=b.offsetHeight-(h||0)-(j||0);b=0==g.length?a.rowsNum:a.rowsNum-1}else{j=a.cellsRange.beginRowIndex;
g=a.cellsRange.endRowIndex;h=0;for(b=f.getElementsByTagName(b,"tr");j<=g;j++)c+=b[j].offsetHeight,h+=1;b=h}var l=n.ie&&9>n.version?Math.ceil(c/b):Math.ceil(c/b)-2*d.tdBorder-2*e,a=a.isFullCol()?f.getElementsByTagName(a.table,"td"):a.selectedTds;p.each(a,function(a){1==a.rowSpan&&a.setAttribute("height",l)})}}};UE.commands.cellalignment={queryCommandState:function(){return w(this).table?0:-1},execCommand:function(a,b){var c=O.getUETableBySelected(this);c?p.each(c.selectedTds,function(a){f.setAttributes(a,
b)}):(c=(c=this.selection.getStart())&&f.findParentByTagName(c,["td","th","caption"],!0),/caption/ig.test(c.tagName)?(c.style.textAlign=b.align,c.style.verticalAlign=b.vAlign):f.setAttributes(c,b),this.selection.getRange().setCursor(!0))},queryCommandValue:function(){var a=w(this).cell;a||(a=P(this)[0]);if(a){var b=UE.UETable.getUETable(a).selectedTds;!b.length&&(b=a);return UE.UETable.getTableCellAlignState(b)}return null}};UE.commands.tablealignment={queryCommandState:function(){return n.ie&&8>
n.version?-1:w(this).table?0:-1},execCommand:function(a,b){var c=this.selection.getStart();(c=c&&f.findParentByTagName(c,["table"],!0))&&c.setAttribute("align",b)}};UE.commands.edittable={queryCommandState:function(){return w(this).table?0:-1},execCommand:function(a,b){var c=this.selection.getRange();if(c=f.findParentByTagName(c.startContainer,"table"))c=f.getElementsByTagName(c,"td").concat(f.getElementsByTagName(c,"th"),f.getElementsByTagName(c,"caption")),p.each(c,function(a){a.style.borderColor=
b})}};UE.commands.edittd={queryCommandState:function(){return w(this).table?0:-1},execCommand:function(a,b){var c=O.getUETableBySelected(this);if(c)p.each(c.selectedTds,function(a){a.style.backgroundColor=b});else if(c=(c=this.selection.getStart())&&f.findParentByTagName(c,["td","th","caption"],!0))c.style.backgroundColor=b}};UE.commands.sorttable={queryCommandState:function(){var a=w(this);if(!a.cell)return-1;for(var a=a.table.getElementsByTagName("td"),b=0,c;c=a[b++];)if(1!=c.rowSpan||1!=c.colSpan)return-1;
return 0},execCommand:function(a,b){var c=this.selection.getRange(),d=c.createBookmark(!0),e=w(this),f=e.cell,e=F(e.table),f=e.getCellInfo(f);e.sortTable(f.cellIndex,b);c.moveToBookmark(d).select()}};UE.commands.enablesort=UE.commands.disablesort={queryCommandState:function(){return w(this).table?0:-1},execCommand:function(a){w(this).table.setAttribute("data-sort","enablesort"==a?"sortEnabled":"sortDisabled")}};UE.commands.settablebackground={queryCommandState:function(){var a=P(this);return a.length&&
"td"===a[0].tagName.toLowerCase()?0:-1},execCommand:function(a,b){var c;c=P(this);F(c[0]).setBackground(c,b)}};UE.commands.cleartablebackground={queryCommandState:function(){var a=P(this);if(!a.length)return-1;for(var b=0,c;c=a[b++];)if(""!==c.style.backgroundColor)return 0;return-1},execCommand:function(){var a=P(this);F(a[0]).removeBackground(a)}};UE.commands.interlacetable=UE.commands.uninterlacetable={queryCommandState:function(a){var b=w(this).table;if(!b)return-1;b=b.getAttribute("interlaced");
return"interlacetable"==a?"enabled"===b?-1:0:!b||"disabled"===b?-1:0},execCommand:function(a,b){var c=w(this).table;"interlacetable"==a?(c.setAttribute("interlaced","enabled"),this.fireEvent("interlacetable",c,b)):(c.setAttribute("interlaced","disabled"),this.fireEvent("uninterlacetable",c))}};UE.plugins.table=function(){function a(a,b,c){a.style[b]&&(c&&a.setAttribute(b,parseInt(a.style[b],10)),a.style[b]="")}function b(a){if("TD"==a.tagName||"TH"==a.tagName)return a;var b;return(b=f.findParentByTagName(a,
"td",!0)||f.findParentByTagName(a,"th",!0))?b:null}function c(a){var b=RegExp(f.fillChar,"g");if(0<a[n.ie?"innerText":"textContent"].replace(/^\s*$/,"").replace(b,"").length)return 0;for(var c in t.$isNotEmpty)if(a.getElementsByTagName(c).length)return 0;return 1}function d(a){return a.pageX||a.pageY?{x:a.pageX,y:a.pageY}:{x:a.clientX+r.document.body.scrollLeft-r.document.body.clientLeft,y:a.clientY+r.document.body.scrollTop-r.document.body.clientTop}}function e(a){try{var c=b(a.target||a.srcElement),
e;if(I&&J)if(r.document.body.style.webkitUserSelect="none",r.selection.getNative()[n.ie?"empty":"removeAllRanges"](),e=d(a),j(r,!0,"",e,c),"h"==I){var k=K.style,m;var c=J,p=D(c);if(p){var q=p.getSameEndPosCells(c,"x")[0],s=p.getSameStartPosXCells(c)[0],t=d(a).x,Lb=(q?f.getXY(q).x:f.getXY(p.table).x)+20,u=s?f.getXY(s).x+s.offsetWidth-20:r.body.offsetWidth+5||parseInt(f.getComputedStyle(r.body,"width"),10);m=t<Lb?Lb:t>u?u:t}else m=void 0;k.left=m+"px"}else{if("v"==I){var Qc=K.style,v;a:{try{var w=f.getXY(J).y,
C=d(a).y;v=C<w?w:C;break a}catch(y){if(F)throw y;}v=void 0}Qc.top=v+"px"}}else if(c){if(!0!==r.fireEvent("excludetable",c)){e=d(a);var x=l(c,e),z=f.findParentByTagName(c,"table",!0);h(z,c,a,!0)?!0!==r.fireEvent("excludetable",z)&&(r.body.style.cursor="url("+r.options.cursorpath+"h.png),pointer"):h(z,c,a)?!0!==r.fireEvent("excludetable",z)&&(r.body.style.cursor="url("+r.options.cursorpath+"v.png),pointer"):(r.body.style.cursor="text",/\d/.test(x)&&(x=x.replace(/\d/,""),c=D(c).getPreviewCell(c,"v"==
x)),j(r,c?!!x:!1,c?x:"",e,c))}}else g(!1,z,r)}catch(A){if(F)throw A;}}function g(a,b,c){if(a){a=f.getXY(b);var d=b.ownerDocument;if(!L||!L.parentNode){L=d.createElement("div");L.contentEditable=!1;L.innerHTML="";L.style.cssText="width:15px;height:15px;background-image:url("+c.options.UEDITOR_HOME_URL+"dialogs/table/dragicon.png);position: absolute;cursor:move;top:"+(a.y-15)+"px;left:"+a.x+"px;";f.unSelectable(L);L.onmouseover=function(){N=!0};L.onmouseout=function(){N=!1};f.on(L,"click",function(){var a=
this;clearTimeout(e);e=setTimeout(function(){c.fireEvent("tableClicked",b,a)},300)});f.on(L,"dblclick",function(){clearTimeout(e);var a=D(b),d=b.rows[0].cells[0],f=a.getLastCell(),f=a.getCellsRange(d,f);c.selection.getRange().setStart(d,0).setCursor(!1,!0);a.setSelected(f)});f.on(L,"dragstart",function(a,b){f.preventDefault(b)});var e;d.body.appendChild(L)}}else N||setTimeout(function(){!N&&L&&L.parentNode&&L.parentNode.removeChild(L)},2E3)}function h(a,b,c,e){c=d(c);b=l(b,c);return e?(e=(e=a.getElementsByTagName("caption")[0])?
e.offsetHeight:0,"v1"==b&&8>c.y-f.getXY(a).y-e):"h1"==b&&8>c.x-f.getXY(a).x}function j(a,b,c,d,e){try{a.body.style.cursor="h"==c?"col-resize":"v"==c?"row-resize":"text",n.ie&&(c&&!P&&!M.getUETableBySelected(a)?(w(a,a.document),y(c,e)):s(a)),O=b}catch(f){if(F)throw f;}}function l(a,b){var c=f.getXY(a);return 4>c.x+a.offsetWidth-b.x?"h":4>b.x-c.x?"h1":4>c.y+a.offsetHeight-b.y?"v":4>b.y-c.y?"v1":""}function k(a,b){if(2==b.button){var c=M.getUETableBySelected(r),e=!1;if(c){var g=Ib(r,b);p.each(c.selectedTds,
function(a){a===g&&(e=!0)});e?(g=c.selectedTds[0],setTimeout(function(){r.selection.getRange().setStart(g,0).setCursor(!1,!0)},0)):(H(f.getElementsByTagName(r.body,"td")),H(f.getElementsByTagName(r.body,"th")),c.clearSelected())}}else if(!b.shiftKey&&(H(f.getElementsByTagName(r.body,"td")),H(f.getElementsByTagName(r.body,"th")),p.each(r.document.getElementsByTagName("table"),function(a){a.ueTable=null}),z=Ib(r,b)))if(c=f.findParentByTagName(z,"table",!0),(c=D(c))&&c.clearSelected(),O){if(!(n.ie&&
8>n.version)){c=l(z,d(b));/\d/.test(c)&&(c=c.replace(/\d/,""),z=D(z).getPreviewCell(z,"v"==c));s(r);for(var h;h=r.document.getElementById("ue_tableDragLine");)f.remove(h);r.fireEvent("saveScene");w(r,r.document);y(c,z);P=!0;I=c;J=z}}else r.document.body.style.webkitUserSelect="",P=!0,r.addListener("mouseover",q)}function m(a,b){if(2!=b.button){var c=this.selection.getRange(),d=f.findParentByTagName(c.startContainer,"table",!0),e=f.findParentByTagName(c.endContainer,"table",!0);if(d||e)d===e?(d=f.findParentByTagName(c.startContainer,
["td","th","caption"],!0),e=f.findParentByTagName(c.endContainer,["td","th","caption"],!0),d!==e&&this.selection.clearRange()):this.selection.clearRange();P=!1;this.document.body.style.webkitUserSelect="";if((!n.ie||n.ie&&7<n.version)&&I&&J){K=this.document.getElementById("ue_tableDragLine");var e=f.getXY(J),g=f.getXY(K);switch(I){case "h":var c=J,h=g.x-e.x-J.offsetWidth;if(!(10>Math.abs(h))){var j=D(c);if(j){var d=j.table,e=u(d),g=M.getDefaultValue(r,d),k=j.getSameEndPosCells(c,"x"),l=u(k[0])-2*
g.tdPadding-g.tdBorder,j=j.getSameStartPosXCells(c),m=u(j[0])-2*g.tdPadding-g.tdBorder;p.each(k,function(a){a.style.width&&(a.style.width="");0>h&&(a.style.wordBreak="break-all");a.setAttribute("width",l+h)});p.each(j,function(a){a.style.width&&(a.style.width="");0<h&&(a.style.wordBreak="break-all");a.setAttribute("width",m-h)});c.nextSibling||(d.style.width&&(d.style.width=""),d.setAttribute("width",e+h))}}break;case "v":if(d=J,c=g.y-e.y-J.offsetHeight,!(10>Math.abs(c))&&(e=D(d))){d=e.getSameEndPosCells(d,
"y");e=d[0]?d[0].offsetHeight:0;for(g=0;k=d[g++];){var s=c,t=e,j=parseInt(f.getComputedStyle(k,"line-height"),10),s=t+s,s=s<j?j:s;k.style.height&&(k.style.height="");1==k.rowSpan?k.setAttribute("height",s):k.removeAttribute&&k.removeAttribute("height")}}}I="";for(J=null;c=this.document.getElementById("ue_tableDragLine");)f.remove(c);this.fireEvent("saveScene");c&&this.document.appendChild(c)}else{if(z)(d=(c=D(z))?c.selectedTds[0]:null)?(c=new R.Range(this.document),f.isEmptyBlock(d)?c.setStart(d,
0).setCursor(!1,!0):c.selectNodeContents(d).shrinkBoundary().setCursor(!1,!0)):(c=this.selection.getRange().shrinkBoundary(),c.collapsed||(d=f.findParentByTagName(c.startContainer,["td","th"],!0),e=f.findParentByTagName(c.endContainer,["td","th"],!0),(d&&!e||!d&&e||d&&e&&d!==e)&&c.setCursor(!1,!0))),z=null,this.removeListener("mouseover",q);else if((d=f.findParentByTagName(b.target||b.srcElement,"td",!0))||(d=f.findParentByTagName(b.target||b.srcElement,"th",!0)),d&&("TD"==d.tagName||"TH"==d.tagName)){if(!0===
this.fireEvent("excludetable",d))return;c=new R.Range(this.document);c.setStart(d,0).setCursor(!1,!0)}this._selectionChange(250,b)}}}function q(a,b){var c=b.target||b.srcElement;G=f.findParentByTagName(c,"td",!0)||f.findParentByTagName(c,"th",!0);if(z&&G&&("TD"==z.tagName&&"TD"==G.tagName||"TH"==z.tagName&&"TH"==G.tagName)&&f.findParentByTagName(z,"table")==f.findParentByTagName(G,"table"))if(c=D(G),z!=G){this.document.body.style.webkitUserSelect="none";this.selection.getNative()[n.ie?"empty":"removeAllRanges"]();
var d=c.getCellsRange(z,G);c.setSelected(d)}else this.document.body.style.webkitUserSelect="",c.clearSelected();b.preventDefault?b.preventDefault():b.returnValue=!1}function u(a){return!a?0:parseInt(f.getComputedStyle(a,"width"),10)}function w(a){P||(K=a.document.createElement("div"),f.setAttributes(K,{id:"ue_tableDragLine",unselectable:"on",contenteditable:!1,onresizestart:"return false",ondragstart:"return false",onselectstart:"return false",style:"background-color:blue;position:absolute;padding:0;margin:0;background-image:none;border:0px none;opacity:0;filter:alpha(opacity=0)"}),
a.body.appendChild(K))}function s(a){if(!P)for(var b;b=a.document.getElementById("ue_tableDragLine");)f.remove(b)}function y(a,b){if(b){var c=f.findParentByTagName(b,"table"),d=c.getElementsByTagName("caption"),e=c.offsetWidth,g=c.offsetHeight-(0<d.length?d[0].offsetHeight:0),c=f.getXY(c),h=f.getXY(b);switch(a){case "h":d="height:"+g+"px;top:"+(c.y+(0<d.length?d[0].offsetHeight:0))+"px;left:"+(h.x+b.offsetWidth-2);K.style.cssText=d+"px;position: absolute;display:block;background-color:blue;width:1px;border:0; color:blue;opacity:.3;filter:alpha(opacity=30)";
break;case "v":d="width:"+e+"px;left:"+c.x+"px;top:"+(h.y+b.offsetHeight-2),K.style.cssText=d+"px;overflow:hidden;position: absolute;display:block;background-color:blue;height:1px;border:0;color:blue;opacity:.2;filter:alpha(opacity=20)"}}}function x(a,b){for(var c=f.getElementsByTagName(a.body,"table"),d,e=0,g;g=c[e++];)d=f.getElementsByTagName(g,"td"),d[0]&&(b?(d=d[0].style.borderColor.replace(/\s/g,""),/(#ffffff)|(rgb\(255,f55,255\))/ig.test(d)&&f.addClass(g,"noBorderTable")):f.removeClasses(g,
"noBorderTable"))}function B(a,b,c){var d=a.body;return d.offsetWidth-(b?2*parseInt(f.getComputedStyle(d,"margin-left"),10):0)-2*c.tableBorder-(a.options.offsetWidth||0)}function Ib(a,b){var c=f.findParentByTagName(b.target||b.srcElement,["td","th"],!0);return c&&!0!==a.fireEvent("excludetable",c)?c:null}var r=this,F=!0,M=UE.UETable,D=function(a){return M.getUETable(a)},H=function(a){return M.removeSelectedClass(a)};r.ready(function(){var a=this,b=a.selection.getText;a.selection.getText=function(){var c=
M.getUETableBySelected(a);if(c){var d="";p.each(c.selectedTds,function(a){d+=a[n.ie?"innerText":"textContent"]});return d}return b.call(a.selection)}});var z=null,G=null,I="",O=!1,L=null,N=!1,K=null,J=null,P=!1;r.setOpt({maxColNum:20,maxRowNum:100,defaultCols:5,defaultRows:5,tdvalign:"top",cursorpath:r.options.UEDITOR_HOME_URL+"themes/default/images/cursor_",tableDragable:!1,classList:["ue-table-interlace-color-single","ue-table-interlace-color-double"]});r.getUETable=D;var S={deletetable:1,inserttable:1,
cellvalign:1,insertcaption:1,deletecaption:1,inserttitle:1,deletetitle:1,mergeright:1,mergedown:1,mergecells:1,insertrow:1,insertrownext:1,deleterow:1,insertcol:1,insertcolnext:1,deletecol:1,splittocells:1,splittorows:1,splittocols:1,adaptbytext:1,adaptbywindow:1,adaptbycustomer:1,insertparagraph:1,insertparagraphbeforetable:1,averagedistributecol:1,averagedistributerow:1};r.ready(function(){p.cssRule("table",".selectTdClass{background-color:#edf5fa !important}table.noBorderTable td,table.noBorderTable th,table.noBorderTable caption{border:1px dashed #ddd !important}table{margin-bottom:10px;border-collapse:collapse;display:table;}td,th{padding: 5px 10px;border: 1px solid #DDD;}caption{border:1px dashed #DDD;border-bottom:0;padding:3px;text-align:center;}th{border-top:2px solid #BBB;background:#F7F7F7;}.ue-table-interlace-color-single{ background-color: #fcfcfc; } .ue-table-interlace-color-double{ background-color: #f7faff; }td p{margin:0;padding:0;}",
r.document);var q,t,u;r.addListener("keydown",function(a,b){var d=b.keyCode||b.which;if(8==d){var e=M.getUETableBySelected(this);e&&e.selectedTds.length&&(e.isFullCol()?this.execCommand("deletecol"):e.isFullRow()?this.execCommand("deleterow"):this.fireEvent("delcells"),f.preventDefault(b));var g=f.findParentByTagName(this.selection.getStart(),"caption",!0),h=this.selection.getRange();h.collapsed&&(g&&c(g))&&(this.fireEvent("saveScene"),e=g.parentNode,f.remove(g),e&&h.setStart(e.rows[0].cells[0],0).setCursor(!1,
!0),this.fireEvent("saveScene"))}if(46==d&&(e=M.getUETableBySelected(this))){this.fireEvent("saveScene");for(g=0;h=e.selectedTds[g++];)f.fillNode(this.document,h);this.fireEvent("saveScene");f.preventDefault(b)}if(13==d){d=this.selection.getRange();if(g=f.findParentByTagName(d.startContainer,"caption",!0)){e=f.findParentByTagName(g,"table");d.collapsed?g&&d.setStart(e.rows[0].cells[0],0).setCursor(!1,!0):(d.deleteContents(),this.fireEvent("saveScene"));f.preventDefault(b);return}if(d.collapsed&&(e=
f.findParentByTagName(d.startContainer,"table")))if(g=e.rows[0].cells[0],h=f.findParentByTagName(this.selection.getStart(),["td","th"],!0),e=e.previousSibling,g===h&&(!e||1==e.nodeType&&"TABLE"==e.tagName)&&f.isStartInblock(d))this.execCommand("insertparagraphbeforetable"),f.preventDefault(b)}if((b.ctrlKey||b.metaKey)&&"67"==b.keyCode)if(q=null,e=M.getUETableBySelected(this)){d=e.selectedTds;t=e.isFullCol();u=e.isFullRow();q=[[e.cloneCell(d[0])]];for(g=1;h=d[g];g++)h.parentNode!==d[g-1].parentNode?
q.push([e.cloneCell(h)]):q[q.length-1].push(e.cloneCell(h))}});r.addListener("tablehasdeleted",function(){j(this,!1,"",null);L&&f.remove(L)});r.addListener("beforepaste",function(b,d){var e=this,g=e.selection.getRange();if(f.findParentByTagName(g.startContainer,"caption",!0))g=e.document.createElement("div"),g.innerHTML=d.html,d.html=g[n.ie?"innerText":"textContent"];else{var h=M.getUETableBySelected(e);if(q){e.fireEvent("saveScene");var g=e.selection.getRange(),j=f.findParentByTagName(g.startContainer,
["td","th"],!0),k,l;if(j){h=D(j);if(u){var m=h.getCellInfo(j).rowIndex;"TH"==j.tagName&&m++;for(var g=0,s;s=q[g++];){l=h.insertRow(m++,"td");for(var r=0,v;v=s[r];r++)(j=l.cells[r])||(j=l.insertCell(r)),j.innerHTML=v.innerHTML,v.getAttribute("width")&&j.setAttribute("width",v.getAttribute("width")),v.getAttribute("vAlign")&&j.setAttribute("vAlign",v.getAttribute("vAlign")),v.getAttribute("align")&&j.setAttribute("align",v.getAttribute("align")),v.style.cssText&&(j.style.cssText=v.style.cssText);for(r=
0;(v=l.cells[r])&&s[r];r++)v.innerHTML=s[r].innerHTML,s[r].getAttribute("width")&&v.setAttribute("width",s[r].getAttribute("width")),s[r].getAttribute("vAlign")&&v.setAttribute("vAlign",s[r].getAttribute("vAlign")),s[r].getAttribute("align")&&v.setAttribute("align",s[r].getAttribute("align")),s[r].style.cssText&&(v.style.cssText=s[r].style.cssText)}}else{if(t){m=h.getCellInfo(j);r=j=0;for(s=q[0];v=s[r++];)j+=v.colSpan||1;e.__hasEnterExecCommand=!0;for(g=0;g<j;g++)e.execCommand("insertcol");e.__hasEnterExecCommand=
!1;j=h.table.rows[0].cells[m.cellIndex];"TH"==j.tagName&&(j=h.table.rows[1].cells[m.cellIndex])}for(g=0;s=q[g++];){k=j;for(r=0;v=s[r++];)j?(j.innerHTML=v.innerHTML,v.getAttribute("width")&&j.setAttribute("width",v.getAttribute("width")),v.getAttribute("vAlign")&&j.setAttribute("vAlign",v.getAttribute("vAlign")),v.getAttribute("align")&&j.setAttribute("align",v.getAttribute("align")),v.style.cssText&&(j.style.cssText=v.style.cssText),l=j,j=j.nextSibling):(m=v.cloneNode(!0),f.removeAttributes(m,["class",
"rowSpan","colSpan"]),l.parentNode.appendChild(m));j=h.getNextCell(k,!0,!0);if(!q[g])break;j||(m=h.getCellInfo(k),h.table.insertRow(h.table.rows.length),h.update(),j=h.getVSideCell(k,!0))}}h.update()}else{h=e.document.createElement("table");for(g=0;s=q[g++];){l=h.insertRow(h.rows.length);for(r=0;v=s[r++];)m=M.cloneCell(v),f.removeAttributes(m,["class"]),l.appendChild(m);2==r&&1<m.rowSpan&&(m.rowSpan=1)}g=M.getDefaultValue(e,void 0);g=e.body.offsetWidth-2*parseInt(f.getComputedStyle(e.body,"margin-left"),
10)-2*g.tableBorder-(e.options.offsetWidth||0);e.execCommand("insertHTML","<table  "+(t&&u?'width="'+g+'"':"")+">"+h.innerHTML.replace(/>\s*</g,"><").replace(/\bth\b/gi,"td")+"</table>")}e.fireEvent("contentchange");e.fireEvent("saveScene");d.html="";return!0}g=e.document.createElement("div");g.innerHTML=d.html;s=g.getElementsByTagName("table");f.findParentByTagName(e.selection.getStart(),"table")?(p.each(s,function(a){f.remove(a)}),f.findParentByTagName(e.selection.getStart(),"caption",!0)&&(g.innerHTML=
g[n.ie?"innerText":"textContent"])):p.each(s,function(b){a(b,"width",!0);a(b,"height",!0);f.removeAttributes(b,["style","border"]);p.each(f.getElementsByTagName(b,"td"),function(b){c(b)&&f.fillNode(e.document,b);a(b,"width",!0);a(b,"height",!0)})});d.html=g.innerHTML}});r.addListener("afterpaste",function(){p.each(f.getElementsByTagName(r.body,"table"),function(a){if(a.offsetWidth>r.body.offsetWidth){var b=M.getDefaultValue(r,a);a.style.width=r.body.offsetWidth-2*parseInt(f.getComputedStyle(r.body,
"margin-left"),10)-2*b.tableBorder-(r.options.offsetWidth||0)+"px"}})});r.addListener("blur",function(){q=null});var v;r.addListener("keydown",function(){clearTimeout(v);v=setTimeout(function(){var a=r.selection.getRange();if(a=f.findParentByTagName(a.startContainer,["th","td"],!0)){var b=a.parentNode.parentNode.parentNode;b.offsetWidth>b.getAttribute("width")&&(a.style.wordBreak="break-all")}},100)});r.addListener("selectionchange",function(){j(r,!1,"",null)});r.addListener("contentchange",function(){var a=
this;s(a);if(!M.getUETableBySelected(a)){var c=a.selection.getRange().startContainer,c=f.findParentByTagName(c,["td","th"],!0);p.each(f.getElementsByTagName(a.document,"table"),function(e){!0!==a.fireEvent("excludetable",e)&&(e.ueTable=new M(e),p.each(f.getElementsByTagName(a.document,"td"),function(b){f.isEmptyBlock(b)&&b!==c&&(f.fillNode(a.document,b),n.ie&&6==n.version&&(b.innerHTML="&nbsp;"))}),p.each(f.getElementsByTagName(a.document,"th"),function(b){f.isEmptyBlock(b)&&b!==c&&(f.fillNode(a.document,
b),n.ie&&6==n.version&&(b.innerHTML="&nbsp;"))}),e.onmouseover=function(){a.fireEvent("tablemouseover",e)},e.onmousemove=function(){a.fireEvent("tablemousemove",e);a.options.tableDragable&&g(!0,this,a)},e.onmouseout=function(){a.fireEvent("tablemouseout",e);j(a,!1,"",null);s(a)},e.onclick=function(c){c=a.window.event||c;var d=b(c.target||c.srcElement);if(d){var e=D(d),f=e.table,g=e.getCellInfo(d),j=a.selection.getRange();h(f,d,c,!0)?(f=e.getCell(e.indexTable[e.rowsNum-1][g.colIndex].rowIndex,e.indexTable[e.rowsNum-
1][g.colIndex].cellIndex),c.shiftKey&&e.selectedTds.length?e.selectedTds[0]!==f?(c=e.getCellsRange(e.selectedTds[0],f),e.setSelected(c)):j&&j.selectNodeContents(f).select():d!==f?(c=e.getCellsRange(d,f),e.setSelected(c)):j&&j.selectNodeContents(f).select()):h(f,d,c)&&(f=e.getCell(e.indexTable[g.rowIndex][e.colsNum-1].rowIndex,e.indexTable[g.rowIndex][e.colsNum-1].cellIndex),c.shiftKey&&e.selectedTds.length?e.selectedTds[0]!==f?(c=e.getCellsRange(e.selectedTds[0],f),e.setSelected(c)):j&&j.selectNodeContents(f).select():
d!==f?(c=e.getCellsRange(d,f),e.setSelected(c)):j&&j.selectNodeContents(f).select())}},e.ondblclick=function(c){c=a.window.event||c;var e=b(c.target||c.srcElement);if(e){var g;if(g=l(e,d(c)))if("h1"==g&&(g="h",h(f.findParentByTagName(e,"table"),e,c)?a.execCommand("adaptbywindow"):(e=D(e).getPreviewCell(e))&&a.selection.getRange().selectNodeContents(e).setCursor(!0,!0)),"h"==g){for(;c=a.document.getElementById("ue_tableDragLine");)f.remove(c);a.fireEvent("saveScene",!0);c=D(e);var j=c.getSameEndPosCells(e,
"x"),k=c.table;k.removeAttribute("width");p.each(j,function(a){a.removeAttribute("width")});setTimeout(function(){var b=j[0].offsetWidth-20;p.each(j,function(a){a.setAttribute("width",b)});k.setAttribute("width",k.offsetWidth);a.fireEvent("saveScene",!0)})}}})});x(a,!0)}});if(!n.ie||n.ie&&7<n.version)f.on(r.document,"mousemove",e);f.on(r.document,"mouseout",function(a){"TABLE"==(a.target||a.srcElement).tagName&&j(r,!1,"",null)});r.addListener("interlacetable",function(a,b,c){if(b){a=b.rows;b=a.length;
var d=0,e=0;for(-1===this.queryCommandState("inserttitle")&&(d=1);d<b;d++,e++)a[d].className=(c||this.options.classList)[e]?(c||this.options.classList)[e]:(c||this.options.classList)[e%(c||this.options.classList).length]}});r.addListener("uninterlacetable",function(a,b){if(b)for(var c=b.rows,d=this.options.classList,e=c.length,g=0;g<e;g++)f.removeClasses(c[g],d)});r.addListener("mousedown",k);r.addListener("mouseup",m);var w=0;r.addListener("mousedown",function(){w=0});r.addListener("tabkeydown",
function(){var a=this.selection.getRange(),b=a.getCommonAncestor(!0,!0),d=f.findParentByTagName(b,"table");if(d){if(f.findParentByTagName(b,"caption",!0))(b=f.getElementsByTagName(d,"th td"))&&b.length&&a.setStart(b[0],0).setCursor(!1,!0);else{var b=f.findParentByTagName(b,["td","th"],!0),e=D(b);w=1<b.rowSpan?w:e.getCellInfo(b).rowIndex;(b=e.getTabNextCell(b,w))?c(b)?a.setStart(b,0).setCursor(!1,!0):a.selectNodeContents(b).select():(r.fireEvent("saveScene"),r.__hasEnterExecCommand=!0,this.execCommand("insertrownext"),
r.__hasEnterExecCommand=!1,a=this.selection.getRange(),a.setStart(d.rows[d.rows.length-1].cells[0],0).setCursor(),r.fireEvent("saveScene"))}return!0}});n.ie&&r.addListener("selectionchange",function(){j(this,!1,"",null)});r.addListener("keydown",function(a,b){var c=b.keyCode||b.which;if(!(8==c||46==c)){(c=!b.ctrlKey&&!b.metaKey&&!b.shiftKey&&!b.altKey)&&H(f.getElementsByTagName(this.body,"td"));var d=M.getUETableBySelected(this);d&&c&&d.clearSelected()}});r.addListener("beforegetcontent",function(){x(this,
!1);n.ie&&p.each(this.document.getElementsByTagName("caption"),function(a){f.isEmptyNode(a)&&(a.innerHTML="&nbsp;")})});r.addListener("aftergetcontent",function(){x(this,!0)});r.addListener("getAllHtml",function(){H(r.document.getElementsByTagName("td"))});r.addListener("fullscreenchanged",function(a,b){if(!b){var c=this.body.offsetWidth/document.body.offsetWidth,d=f.getElementsByTagName(this.body,"table");p.each(d,function(a){if(a.offsetWidth<r.body.offsetWidth)return!1;var b=f.getElementsByTagName(a,
"td"),d=[];p.each(b,function(a){d.push(a.offsetWidth)});for(var e=0,g;g=b[e];e++)g.setAttribute("width",Math.floor(d[e]*c));a.setAttribute("width",Math.floor(B(r,!0,M.getDefaultValue(r,void 0))))})}});var C=r.execCommand;r.execCommand=function(a){a=a.toLowerCase();var b=M.getUETableBySelected(this),d=new R.Range(this.document),e=this.commands[a]||UE.commands[a],g;if(e){if(b&&!S[a]&&!e.notNeedUndo&&!this.__hasEnterExecCommand){this.__hasEnterExecCommand=!0;this.fireEvent("beforeexeccommand",a);for(var b=
b.selectedTds,h=e=-2,j,k,l=0,m;m=b[l];l++)if(c(m)?d.setStart(m,0).setCursor(!1,!0):d.selectNodeContents(m).select(!0),k=this.queryCommandState(a),j=this.queryCommandValue(a),-1!=k){if(e!==k||h!==j)this._ignoreContentChange=!0,g=C.apply(this,arguments),this._ignoreContentChange=!1;e=this.queryCommandState(a);h=this.queryCommandValue(a);f.isEmptyBlock(m)&&f.fillNode(this.document,m)}d.setStart(b[0],0).shrinkBoundary(!0).setCursor(!1,!0);this.fireEvent("contentchange");this.fireEvent("afterexeccommand",
a);this.__hasEnterExecCommand=!1;this._selectionChange()}else g=C.apply(this,arguments);return g}}})};UE.plugins.contextmenu=function(){var a=this,b=a.getLang("contextMenu"),c,d=a.options.contextMenu||[{label:b.selectall,cmdName:"selectall"},{label:b.deletecode,cmdName:"highlightcode",icon:"deletehighlightcode"},{label:b.cleardoc,cmdName:"cleardoc",exec:function(){confirm(b.confirmclear)&&this.execCommand("cleardoc")}},"-",{label:b.unlink,cmdName:"unlink"},"-",{group:b.paragraph,icon:"justifyjustify",
subMenu:[{label:b.justifyleft,cmdName:"justify",value:"left"},{label:b.justifyright,cmdName:"justify",value:"right"},{label:b.justifycenter,cmdName:"justify",value:"center"},{label:b.justifyjustify,cmdName:"justify",value:"justify"}]},"-",{group:b.table,icon:"table",subMenu:[{label:b.inserttable,cmdName:"inserttable"},{label:b.deletetable,cmdName:"deletetable"},"-",{label:b.deleterow,cmdName:"deleterow"},{label:b.deletecol,cmdName:"deletecol"},{label:b.insertcol,cmdName:"insertcol"},{label:b.insertcolnext,
cmdName:"insertcolnext"},{label:b.insertrow,cmdName:"insertrow"},{label:b.insertrownext,cmdName:"insertrownext"},"-",{label:b.insertcaption,cmdName:"insertcaption"},{label:b.deletecaption,cmdName:"deletecaption"},{label:b.inserttitle,cmdName:"inserttitle"},{label:b.deletetitle,cmdName:"deletetitle"},"-",{label:b.mergecells,cmdName:"mergecells"},{label:b.mergeright,cmdName:"mergeright"},{label:b.mergedown,cmdName:"mergedown"},"-",{label:b.splittorows,cmdName:"splittorows"},{label:b.splittocols,cmdName:"splittocols"},
{label:b.splittocells,cmdName:"splittocells"},"-",{label:b.averageDiseRow,cmdName:"averagedistributerow"},{label:b.averageDisCol,cmdName:"averagedistributecol"},"-",{label:b.edittd,cmdName:"edittd",exec:function(){UE.ui.edittd&&new UE.ui.edittd(this);this.getDialog("edittd").open()}},{label:b.edittable,cmdName:"edittable",exec:function(){UE.ui.edittable&&new UE.ui.edittable(this);this.getDialog("edittable").open()}}]},{group:b.tablesort,icon:"tablesort",subMenu:[{label:b.reversecurrent,cmdName:"sorttable",
value:1},{label:b.orderbyasc,cmdName:"sorttable"},{label:b.reversebyasc,cmdName:"sorttable",exec:function(){this.execCommand("sorttable",function(a,b){return b.innerHTML.localeCompare(a.innerHTML)})}},{label:b.orderbynum,cmdName:"sorttable",exec:function(){this.execCommand("sorttable",function(a,b){var c=a.innerHTML.match(/\d+/),d=b.innerHTML.match(/\d+/);c&&(c=+c[0]);d&&(d=+d[0]);return(c||0)-(d||0)})}},{label:b.reversebynum,cmdName:"sorttable",exec:function(){this.execCommand("sorttable",function(a,
b){var c=a.innerHTML.match(/\d+/),d=b.innerHTML.match(/\d+/);c&&(c=+c[0]);d&&(d=+d[0]);return(d||0)-(c||0)})}}]},{group:b.borderbk,icon:"borderBack",subMenu:[{label:b.setcolor,cmdName:"interlacetable",exec:function(){this.execCommand("interlacetable")}},{label:b.unsetcolor,cmdName:"uninterlacetable",exec:function(){this.execCommand("uninterlacetable")}},{label:b.setbackground,cmdName:"settablebackground",exec:function(){this.execCommand("settablebackground",{repeat:!0,colorList:["#bbb","#ccc"]})}},
{label:b.unsetbackground,cmdName:"cleartablebackground",exec:function(){this.execCommand("cleartablebackground")}},{label:b.redandblue,cmdName:"settablebackground",exec:function(){this.execCommand("settablebackground",{repeat:!0,colorList:["red","blue"]})}},{label:b.threecolorgradient,cmdName:"settablebackground",exec:function(){this.execCommand("settablebackground",{repeat:!0,colorList:["#aaa","#bbb","#ccc"]})}}]},{group:b.aligntd,icon:"aligntd",subMenu:[{cmdName:"cellalignment",value:{align:"left",
vAlign:"top"}},{cmdName:"cellalignment",value:{align:"center",vAlign:"top"}},{cmdName:"cellalignment",value:{align:"right",vAlign:"top"}},{cmdName:"cellalignment",value:{align:"left",vAlign:"middle"}},{cmdName:"cellalignment",value:{align:"center",vAlign:"middle"}},{cmdName:"cellalignment",value:{align:"right",vAlign:"middle"}},{cmdName:"cellalignment",value:{align:"left",vAlign:"bottom"}},{cmdName:"cellalignment",value:{align:"center",vAlign:"bottom"}},{cmdName:"cellalignment",value:{align:"right",
vAlign:"bottom"}}]},{group:b.aligntable,icon:"aligntable",subMenu:[{cmdName:"tablealignment",className:"left",label:b.tableleft,value:"left"},{cmdName:"tablealignment",className:"center",label:b.tablecenter,value:"center"},{cmdName:"tablealignment",className:"right",label:b.tableright,value:"right"}]},"-",{label:b.insertparagraphbefore,cmdName:"insertparagraph",value:!0},{label:b.insertparagraphafter,cmdName:"insertparagraph"},{label:b.copy,cmdName:"copy",exec:function(){alert(b.copymsg)},query:function(){return 0}},
{label:b.paste,cmdName:"paste",exec:function(){alert(b.pastemsg)},query:function(){return 0}},{label:b.highlightcode,cmdName:"highlightcode",exec:function(){UE.ui.highlightcode&&new UE.ui.highlightcode(this);this.ui._dialogs.highlightcodeDialog.open()}}];if(d.length){var e=UE.ui.uiUtils;a.addListener("contextmenu",function(g,h){var j=e.getViewportOffsetByEvent(h);a.fireEvent("beforeselectionchange");c&&c.destroy();for(var l=0,k,m=[];k=d[l];l++){var p;(function(c){if("-"==c)(p=m[m.length-1])&&"-"!==
p&&m.push("-");else if(c.hasOwnProperty("group")){for(var d=0,e,f=[];e=c.subMenu[d];d++)(function(b){if("-"==b)(p=f[f.length-1])&&"-"!==p?f.push("-"):f.splice(f.length-1);else if((a.commands[b.cmdName]||UE.commands[b.cmdName]||b.query)&&-1<(b.query?b.query():a.queryCommandState(b.cmdName)))f.push({label:b.label||a.getLang("contextMenu."+b.cmdName+(b.value||""))||"",className:"edui-for-"+b.cmdName+(b.className?" edui-for-"+b.cmdName+"-"+b.className:""),onclick:b.exec?function(){b.exec.call(a)}:function(){a.execCommand(b.cmdName,
b.value)}})})(e);f.length&&m.push({label:function(){switch(c.icon){case "table":return a.getLang("contextMenu.table");case "justifyjustify":return a.getLang("contextMenu.paragraph");case "aligntd":return a.getLang("contextMenu.aligntd");case "aligntable":return a.getLang("contextMenu.aligntable");case "tablesort":return b.tablesort;case "borderBack":return b.borderbk;default:return""}}(),className:"edui-for-"+c.icon,subMenu:{items:f,editor:a}})}else if((a.commands[c.cmdName]||UE.commands[c.cmdName]||
c.query)&&-1<(c.query?c.query.call(a):a.queryCommandState(c.cmdName)))"highlightcode"==c.cmdName&&(1==a.queryCommandState(c.cmdName)&&"deletehighlightcode"!=c.icon||1!=a.queryCommandState(c.cmdName)&&"deletehighlightcode"==c.icon)||m.push({label:c.label||a.getLang("contextMenu."+c.cmdName),className:"edui-for-"+(c.icon?c.icon:c.cmdName+(c.value||"")),onclick:c.exec?function(){c.exec.call(a)}:function(){a.execCommand(c.cmdName,c.value)}})})(k)}"-"==m[m.length-1]&&m.pop();c=new UE.ui.Menu({items:m,
editor:a});c.render();c.showAt(j);f.preventDefault(h);if(n.ie){var q;try{q=a.selection.getNative().createRange()}catch(t){return}q.item&&(new R.Range(a.document)).selectNode(q.item(0)).select(!0,!0)}})}};UE.plugins.basestyle=function(){var a={bold:["strong","b"],italic:["em","i"],subscript:["sub"],superscript:["sup"]},b=this;b.addshortcutkey({Bold:"ctrl+66",Italic:"ctrl+73",Underline:"ctrl+85"});b.addInputRule(function(a){p.each(a.getNodesByTagName("b i"),function(a){switch(a.tagName){case "b":a.tagName=
"strong";break;case "i":a.tagName="em"}})});for(var c in a)(function(a,c){b.commands[a]={execCommand:function(a){var d=b.selection.getRange(),j=f.filterNodeList(this.selection.getStartElementPath(),c);if(d.collapsed){if(j)a=b.document.createTextNode(""),d.insertNode(a).removeInlineStyle(c),d.setStartBefore(a),f.remove(a);else{j=d.document.createElement(c[0]);if("superscript"==a||"subscript"==a)a=b.document.createTextNode(""),d.insertNode(a).removeInlineStyle(["sub","sup"]).setStartBefore(a).collapse(!0);
d.insertNode(j).setStart(j,0)}d.collapse(!0)}else{if("superscript"==a||"subscript"==a)(!j||j.tagName.toLowerCase()!=a)&&d.removeInlineStyle(["sub","sup"]);j?d.removeInlineStyle(c):d.applyInlineStyle(c[0])}d.select()},queryCommandState:function(){return f.filterNodeList(this.selection.getStartElementPath(),c)?1:0}}})(c,a[c])};UE.plugins.elementpath=function(){var a,b,c=this;c.setOpt("elementPathEnabled",!0);c.options.elementPathEnabled&&(c.commands.elementpath={execCommand:function(d,e){var f=b[e],
h=c.selection.getRange();a=1*e;h.selectNode(f).select()},queryCommandValue:function(){var c=[].concat(this.selection.getStartElementPath()).reverse(),e=[];b=c;for(var f=0,h;h=c[f];f++)if(3!=h.nodeType){var j=h.tagName.toLowerCase();"img"==j&&h.getAttribute("anchorname")&&(j="anchor");e[f]=j;if(a==f){a=-1;break}}return e}})};UE.plugins.formatmatch=function(){function a(g,h){if(n.webkit)var j="IMG"==h.target.tagName?h.target:null;b.undoManger&&b.undoManger.save();var l=b.selection.getRange(),j=j||l.getClosedNode();
if(d&&j&&"IMG"==j.tagName)j.style.cssText+=";float:"+(d.style.cssFloat||d.style.styleFloat||"none")+";display:"+(d.style.display||"inline"),d=null;else if(!d){if(l.collapsed){var k=b.document.createTextNode("match");l.insertNode(k).select()}b.__hasEnterExecCommand=!0;l=b.options.removeFormatAttributes;b.options.removeFormatAttributes="";b.execCommand("removeformat");b.options.removeFormatAttributes=l;b.__hasEnterExecCommand=!1;l=b.selection.getRange();c.length&&(j=l,k&&j.selectNode(k),j.applyInlineStyle(c[c.length-
1].tagName,null,c));k&&l.setStartBefore(k).collapse(!0);l.select();k&&f.remove(k)}b.undoManger&&b.undoManger.save();b.removeListener("mouseup",a);e=0}var b=this,c=[],d,e=0;b.addListener("reset",function(){c=[];e=0});b.commands.formatmatch={execCommand:function(){if(e)e=0,c=[],b.removeListener("mouseup",a);else{var g=b.selection.getRange();d=g.getClosedNode();if(!d||"IMG"!=d.tagName){g.collapse(!0).shrinkBoundary();c=f.findParents(g.startContainer,!0,function(a){return!f.isBlockElm(a)&&1==a.nodeType});
for(var g=0,h;h=c[g];g++)if("A"==h.tagName){c.splice(g,1);break}}b.addListener("mouseup",a);e=1}},queryCommandState:function(){return e},notNeedUndo:1}};UE.plugins.searchreplace=function(){var a,b;this.addListener("reset",function(){b=a=null});this.commands.searchreplace={execCommand:function(c,d){var e=this.selection,f,h=0;d=p.extend(d,{all:!1,casesensitive:!1,dir:1},!0);if(n.ie)for(this.focus();;){var j;f=this.document.selection.createRange();j=f.duplicate();j.moveToElementText(this.document.body);
d.all?(b=0,d.dir=1,a?j.setEndPoint(-1==d.dir?"EndToStart":"StartToEnd",a):j.moveToElementText(this.document.body)):(j.setEndPoint(-1==d.dir?"EndToStart":"StartToEnd",f),d.hasOwnProperty("replaceStr")&&j.setEndPoint(-1==d.dir?"StartToEnd":"EndToStart",f));j.duplicate();if(!j.findText(d.searchStr,d.dir,d.casesensitive?4:0))return a=null,j=this.document.selection.createRange(),j.scrollIntoView(),h;j.select();d.hasOwnProperty("replaceStr")&&(f=e.getRange(),f.deleteContents().insertNode(f.document.createTextNode(d.replaceStr)).select(),
a=e.getNative().createRange());h++;if(!d.all)break}else{j=this.window;for(e=e.getNative();;){d.all?(a?(a.collapse(!1),f=a):(f=this.document.createRange(),f.setStart(this.document.body,0),f.collapse(!0)),e.removeAllRanges(),e.addRange(f),b=0,d.dir=1):(n.safari&&this.selection.getRange().select(),e=j.getSelection(),e.rangeCount?f=e.getRangeAt(0):(f=this.document.createRange(),f.setStart(this.body,0),f.collapse(!0),e.addRange(f)),d.hasOwnProperty("replaceStr")&&f.collapse(1==d.dir?!0:!1));b?e.removeAllRanges():
(f.collapse(0>d.dir?!0:!1),e.removeAllRanges(),e.addRange(f));if(!j.find(d.searchStr,d.casesensitive,0>d.dir?!0:!1))return a=null,e.removeAllRanges(),h;b=0;f=j.getSelection().getRangeAt(0);if(!f.collapsed&&d.hasOwnProperty("replaceStr")){f.deleteContents();var l=j.document.createTextNode(d.replaceStr);f.insertNode(l);f.selectNode(l);e.addRange(f);a=f.cloneRange()}h++;if(!d.all)break}}return!0}}};UE.plugins.customstyle=function(){var a=this;a.setOpt({customstyle:[{tag:"h1",name:"tc",style:"font-size:32px;font-weight:bold;border-bottom:#ccc 2px solid;padding:0 4px 0 0;text-align:center;margin:0 0 20px 0;"},
{tag:"h1",name:"tl",style:"font-size:32px;font-weight:bold;border-bottom:#ccc 2px solid;padding:0 4px 0 0;text-align:left;margin:0 0 10px 0;"},{tag:"span",name:"im",style:"font-size:16px;font-style:italic;font-weight:bold;line-height:18px;"},{tag:"span",name:"hi",style:"font-size:16px;font-style:italic;font-weight:bold;color:rgb(51, 153, 204);line-height:18px;"}]});a.commands.customstyle={execCommand:function(a,c){var d=c.tag,e=f.findParent(this.selection.getStart(),function(a){return a.getAttribute("label")},
!0),g,h,j={};for(g in c)void 0!==c[g]&&(j[g]=c[g]);delete j.tag;if(e&&e.getAttribute("label")==c.label){g=this.selection.getRange();h=g.createBookmark();if(g.collapsed)if(t.$block[e.tagName]){var l=this.document.createElement("p");f.moveChild(e,l);e.parentNode.insertBefore(l,e);f.remove(e)}else f.remove(e,!0);else{e=f.getCommonAncestor(h.start,h.end);j=f.getElementsByTagName(e,d);RegExp(d,"i").test(e.tagName)&&j.push(e);for(var k=0,m;m=j[k++];)if(m.getAttribute("label")==c.label){var l=f.getPosition(m,
h.start),n=f.getPosition(m,h.end);if((l&f.POSITION_FOLLOWING||l&f.POSITION_CONTAINS)&&(n&f.POSITION_PRECEDING||n&f.POSITION_CONTAINS)&&t.$block[d])l=this.document.createElement("p"),f.moveChild(m,l),m.parentNode.insertBefore(l,m);f.remove(m,!0)}(e=f.findParent(e,function(a){return a.getAttribute("label")==c.label},!0))&&f.remove(e,!0)}g.moveToBookmark(h).select()}else t.$block[d]?(this.execCommand("paragraph",d,j,"customstyle"),g=this.selection.getRange(),g.collapsed||(g.collapse(),e=f.findParent(this.selection.getStart(),
function(a){return a.getAttribute("label")==c.label},!0),d=this.document.createElement("p"),f.insertAfter(e,d),f.fillNode(this.document,d),g.setStart(d,0).setCursor())):(g=this.selection.getRange(),g.collapsed?(e=this.document.createElement(d),f.setAttributes(e,j),g.insertNode(e).setStart(e,0).setCursor()):(h=g.createBookmark(),g.applyInlineStyle(d,j).moveToBookmark(h).select()))},queryCommandValue:function(){var a=f.filterNodeList(this.selection.getStartElementPath(),function(a){return a.getAttribute("label")});
return a?a.getAttribute("label"):""}};a.addListener("keyup",function(b,c){var d=c.keyCode||c.which;if(32==d||13==d)if(d=a.selection.getRange(),d.collapsed){var e=f.findParent(a.selection.getStart(),function(a){return a.getAttribute("label")},!0);if(e&&t.$block[e.tagName]&&f.isEmptyNode(e)){var g=a.document.createElement("p");f.insertAfter(e,g);f.fillNode(a.document,g);f.remove(e);d.setStart(g,0).setCursor()}}})};UE.plugins.catchremoteimage=function(){if(!1!==this.options.catchRemoteImageEnable){var a=
this;this.setOpt({localDomain:["127.0.0.1","localhost","img.baidu.com"],separater:"ue_separate_ue",catchFieldName:"upfile",catchRemoteImageEnable:!0});var b=UE.ajax,c=a.options.localDomain,d=a.options.catcherUrl,e=a.options.separater;a.addListener("afterpaste",function(){a.fireEvent("catchRemoteImage")});a.addListener("catchRemoteImage",function(){for(var g=[],h=f.getElementsByTagName(a.document,"img"),j=0,l;l=h[j++];)if(!l.getAttribute("word_img")){l=l.getAttribute("_src")||l.src||"";var k;if(k=
/^(https?|ftp):/i.test(l)){a:{k=l;for(var m=c,n=0,p=void 0;p=m[n++];)if(-1!==k.indexOf(p)){k=!0;break a}k=!1}k=!k}k&&g.push(l)}g.length&&(j={success:function(b){try{var c=eval("("+b.responseText+")")}catch(d){return}b=c.srcUrl.split(e);for(var c=c.url.split(e),g=0,j;j=h[g++];)for(var k=j.getAttribute("_src")||j.src||"",l=0,m;m=b[l++];){var n=c[l-1];if(k==m&&"error"!=n){k=a.options.catcherPath+n;f.setAttributes(j,{src:k,_src:k});break}}a.fireEvent("catchremotesuccess")},error:function(){a.fireEvent("catchremoteerror")}},
g=g.join(e),j={timeout:6E4,onsuccess:j.success,onerror:j.error},j[a.options.catchFieldName]=g,b.request(d,j))})}};UE.plugins.snapscreen=function(){var a,b;this.setOpt({snapscreenServerPort:location.port,snapscreenImgAlign:"",snapscreenHost:location.hostname});this.commands.snapscreen={execCommand:function(){var c=this,d=c.getLang("snapScreen_plugin");if(!b){var e=c.container;a=e.ownerDocument||e.document;b=a.createElement("object");try{b.type="application/x-pluginbaidusnap"}catch(f){return}b.style.cssText=
"position:absolute;left:-9999px;";b.setAttribute("width","0");b.setAttribute("height","0");e.appendChild(b)}var h=c.options,e=function(a){try{a=eval("("+a+")")}catch(b){alert(d.callBackErrorMsg);return}"SUCCESS"!=a.state?alert(a.state):c.execCommand("insertimage",{src:h.snapscreenPath+a.url,floatStyle:h.snapscreenImgAlign,_src:h.snapscreenPath+a.url})};try{var j=h.snapscreenServerPort+"";h.snapscreenServerUrl=h.snapscreenServerUrl.split(h.snapscreenHost);h.snapscreenServerUrl=h.snapscreenServerUrl[1]||
h.snapscreenServerUrl[0];0===h.snapscreenServerUrl.indexOf(":"+j)&&(h.snapscreenServerUrl=h.snapscreenServerUrl.substring(j.length+1));var l=b.saveSnapshot(h.snapscreenHost,h.snapscreenServerUrl,j);e(l)}catch(k){c.ui._dialogs.snapscreenDialog.open()}}}};UE.commands.insertparagraph={execCommand:function(a,b){for(var c=this.selection.getRange(),d=c.startContainer,e;d&&!f.isBody(d);)e=d,d=d.parentNode;e&&(d=this.document.createElement("p"),b?e.parentNode.insertBefore(d,e):e.parentNode.insertBefore(d,
e.nextSibling),f.fillNode(this.document,d),c.setStart(d,0).setCursor(!1,!0))}};UE.plugins.webapp=function(){function a(a,b,f){return!b?(f?"<p>":"")+'<img title="'+a.title+'" width="'+a.width+'" height="'+a.height+'" src="'+c.options.UEDITOR_HOME_URL+'themes/default/images/spacer.gif" style="background:url('+a.logo+') no-repeat center center; border:1px solid gray;" class="edui-faked-webapp" _url="'+a.url+'" />'+(f?"</p>":""):'<iframe class="edui-faked-webapp" title="'+a.title+'" width="'+a.width+
'" height="'+a.height+'"  scrolling="no" frameborder="0" src="'+a.url+'" logo_url = '+a.logo+"></iframe>"}function b(b){for(var e,g=f.getElementsByTagName(c.document,!b?"iframe":"img"),h=0,j;j=g[h++];)"edui-faked-webapp"==j.className&&(e=c.document.createElement("div"),e.innerHTML=a(b?{url:j.getAttribute("_url"),width:j.width,height:j.height,title:j.title,logo:j.style.backgroundImage.replace("url(","").replace(")","")}:{url:j.getAttribute("src",2),title:j.title,width:j.width,height:j.height,logo:j.getAttribute("logo_url")},
b?!0:!1,!1),j.parentNode.replaceChild(e.firstChild,j))}var c=this;c.addListener("beforegetcontent",function(){b(!0)});c.addListener("aftersetcontent",function(){b(!1)});c.addListener("aftergetcontent",function(a){"aftergetcontent"==a&&c.queryCommandState("source")||b(!1)});c.commands.webapp={execCommand:function(b,e){c.execCommand("inserthtml",a(e,!1,!0))}}};UE.plugins.template=function(){UE.commands.template={execCommand:function(a,b){b.html&&this.execCommand("inserthtml",b.html)}};this.addListener("click",
function(a,b){var c=b.target||b.srcElement,d=this.selection.getRange();(c=f.findParent(c,function(a){if(a.className&&f.hasClass(a,"ue_t"))return a},!0))&&d.selectNode(c).shrinkBoundary().select()});this.addListener("keydown",function(a,b){var c=this.selection.getRange();!c.collapsed&&!b.ctrlKey&&!b.metaKey&&!b.shiftKey&&!b.altKey&&(c=f.findParent(c.startContainer,function(a){if(a.className&&f.hasClass(a,"ue_t"))return a},!0))&&f.removeClasses(c,["ue_t"])})};UE.plugins.music=function(){function a(a,
b,f,h,j,l){return!j?(l?"<p "+("none"!=h?"center"==h?' style="text-align:center;" ':' style="float:"'+h:"")+">":"")+'<img align="'+h+'" width="'+b+'" height="'+f+'" _url="'+a+'" class="edui-faked-music" src="'+c.options.langPath+c.options.lang+'/images/music.png" />'+(l?"</p>":""):'<embed type="application/x-shockwave-flash" class="edui-faked-music" pluginspage="http://www.macromedia.com/go/getflashplayer" src="'+a+'" width="'+b+'" height="'+f+'" align="'+h+'"'+("none"!=h?' style= "'+("center"==h?
"display:block;":" float: "+h)+'"':"")+' wmode="transparent" play="true" loop="false" menu="false" allowscriptaccess="never" allowfullscreen="true" >'}function b(b){for(var e,g=f.getElementsByTagName(c.document,!b?"embed":"img"),h=0,j;j=g[h++];)if("edui-faked-music"==j.className){e=c.document.createElement("div");var l=f.getComputedStyle(j,"float"),l="none"==l?j.getAttribute("align")||"":l;e.innerHTML=a(b?j.getAttribute("_url"):j.getAttribute("src"),j.width,j.height,l,b);j.parentNode.replaceChild(e.firstChild,
j)}}var c=this;c.addListener("beforegetcontent",function(){b(!0)});c.addListener("aftersetcontent",function(){b(!1)});c.addListener("aftergetcontent",function(a){"aftergetcontent"==a&&c.queryCommandState("source")||b(!1)});c.commands.music={execCommand:function(b,c){var f=a(c.url,c.width||400,c.height||95,"none",!1,!0);this.execCommand("inserthtml",f)},queryCommandState:function(){var a=this.selection.getRange().getClosedNode();return a&&"edui-faked-music"==a.className?1:0}}};q=q||{};q.editor=q.editor||
{};q.editor.ui={};var Ma=function(){var a=document.getElementById("edui_fixedlayer");Y.setViewportOffset(a,{left:0,top:0})},V=q.editor.browser,ba=q.editor.dom.domUtils,Mb=window.$EDITORUI={},Nb=0,Y=q.editor.ui.uiUtils={uid:function(a){return a?a.ID$EDITORUI||(a.ID$EDITORUI=++Nb):++Nb},hook:function(a,b){var c;a&&a._callbacks?c=a:(c=function(){var b;a&&(b=a.apply(this,arguments));for(var e=c._callbacks,f=e.length;f--;){var h=e[f].apply(this,arguments);void 0===b&&(b=h)}return b},c._callbacks=[]);c._callbacks.push(b);
return c},createElementByHtml:function(a){var b=document.createElement("div");b.innerHTML=a;b=b.firstChild;b.parentNode.removeChild(b);return b},getViewportElement:function(){return V.ie&&V.quirks?document.body:document.documentElement},getClientRect:function(a){var b;try{b=a.getBoundingClientRect()}catch(c){b={left:0,top:0,height:0,width:0}}for(var d={left:Math.round(b.left),top:Math.round(b.top),height:Math.round(b.bottom-b.top),width:Math.round(b.right-b.left)},e;(e=a.ownerDocument)!==document&&
(a=ba.getWindow(e).frameElement);)b=a.getBoundingClientRect(),d.left+=b.left,d.top+=b.top;d.bottom=d.top+d.height;d.right=d.left+d.width;return d},getViewportRect:function(){var a=Y.getViewportElement(),b=(window.innerWidth||a.clientWidth)|0,a=(window.innerHeight||a.clientHeight)|0;return{left:0,top:0,height:a,width:b,bottom:a,right:b}},setViewportOffset:function(a,b){var c=Y.getFixedLayer();a.parentNode===c?(a.style.left=b.left+"px",a.style.top=b.top+"px"):ba.setViewportOffset(a,b)},getEventOffset:function(a){var b=
Y.getClientRect(a.target||a.srcElement);a=Y.getViewportOffsetByEvent(a);return{left:a.left-b.left,top:a.top-b.top}},getViewportOffsetByEvent:function(a){var b=a.target||a.srcElement,c=ba.getWindow(b).frameElement;a={left:a.clientX,top:a.clientY};c&&b.ownerDocument!==document&&(b=Y.getClientRect(c),a.left+=b.left,a.top+=b.top);return a},setGlobal:function(a,b){Mb[a]=b;return'$EDITORUI["'+a+'"]'},unsetGlobal:function(a){delete Mb[a]},copyAttributes:function(a,b){for(var c=b.attributes,d=c.length;d--;){var e=
c[d];"style"!=e.nodeName&&("class"!=e.nodeName&&(!V.ie||e.specified))&&a.setAttribute(e.nodeName,e.nodeValue)}b.className&&ba.addClass(a,b.className);b.style.cssText&&(a.style.cssText+=";"+b.style.cssText)},removeStyle:function(a,b){if(a.style.removeProperty)a.style.removeProperty(b);else if(a.style.removeAttribute)a.style.removeAttribute(b);else throw"";},contains:function(a,b){return a&&b&&(a===b?!1:a.contains?a.contains(b):a.compareDocumentPosition(b)&16)},startDrag:function(a,b,c){function d(a){b.ondragmove(a.clientX-
e,a.clientY-f,a);a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}c=c||document;var e=a.clientX,f=a.clientY;if(c.addEventListener){var h=function(){c.removeEventListener("mousemove",d,!0);c.removeEventListener("mouseup",h,!0);window.removeEventListener("mouseup",h,!0);b.ondragstop()};c.addEventListener("mousemove",d,!0);c.addEventListener("mouseup",h,!0);window.addEventListener("mouseup",h,!0);a.preventDefault()}else{var j=a.srcElement;j.setCapture();var l=function(){j.releaseCapture();j.detachEvent("onmousemove",
d);j.detachEvent("onmouseup",l);j.detachEvent("onlosecaptrue",l);b.ondragstop()};j.attachEvent("onmousemove",d);j.attachEvent("onmouseup",l);j.attachEvent("onlosecaptrue",l);a.returnValue=!1}b.ondragstart()},getFixedLayer:function(){var a=document.getElementById("edui_fixedlayer");null==a&&(a=document.createElement("div"),a.id="edui_fixedlayer",document.body.appendChild(a),V.ie&&8>=V.version?(a.style.position="absolute",ba.on(window,"scroll",Ma),ba.on(window,"resize",q.editor.utils.defer(Ma,0,!0)),
setTimeout(Ma)):a.style.position="fixed",a.style.left="0",a.style.top="0",a.style.width="0",a.style.height="0");return a},makeUnselectable:function(a){if(V.opera||V.ie&&9>V.version){if(a.unselectable="on",a.hasChildNodes())for(var b=0;b<a.childNodes.length;b++)1==a.childNodes[b].nodeType&&Y.makeUnselectable(a.childNodes[b])}else void 0!==a.style.MozUserSelect?a.style.MozUserSelect="none":void 0!==a.style.WebkitUserSelect?a.style.WebkitUserSelect="none":void 0!==a.style.KhtmlUserSelect&&(a.style.KhtmlUserSelect=
"none")}},Ob=q.editor.utils,ca=q.editor.ui.uiUtils,Rc=q.editor.EventBase,Pb=q.editor.ui.UIBase=function(){};Pb.prototype={className:"",uiName:"",initOptions:function(a){for(var b in a)this[b]=a[b];this.id=this.id||"edui"+ca.uid()},initUIBase:function(){this._globalKey=Ob.unhtml(ca.setGlobal(this.id,this))},render:function(a){for(var b=this.renderHtml(),b=ca.createElementByHtml(b),c=f.getElementsByTagName(b,"*"),d="edui-"+(this.theme||this.editor.options.theme),e=document.getElementById("edui_fixedlayer"),
g=0,h;h=c[g++];)f.addClass(h,d);f.addClass(b,d);e&&(e.className="",f.addClass(e,d));c=this.getDom();null!=c?(c.parentNode.replaceChild(b,c),ca.copyAttributes(b,c)):("string"==typeof a&&(a=document.getElementById(a)),a=a||ca.getFixedLayer(),f.addClass(a,d),a.appendChild(b));this.postRender()},getDom:function(a){return a?document.getElementById(this.id+"_"+a):document.getElementById(this.id)},postRender:function(){this.fireEvent("postrender")},getHtmlTpl:function(){return""},formatHtml:function(a){var b=
"edui-"+this.uiName;return a.replace(/##/g,this.id).replace(/%%-/g,this.uiName?b+"-":"").replace(/%%/g,(this.uiName?b:"")+" "+this.className).replace(/\$\$/g,this._globalKey)},renderHtml:function(){return this.formatHtml(this.getHtmlTpl())},dispose:function(){var a=this.getDom();a&&q.editor.dom.domUtils.remove(a);ca.unsetGlobal(this.id)}};Ob.inherits(Pb,Rc);var Sc=q.editor.utils,Tc=q.editor.ui.UIBase,Qb=q.editor.ui.Separator=function(a){this.initOptions(a);this.initSeparator()};Qb.prototype={uiName:"separator",
initSeparator:function(){this.initUIBase()},getHtmlTpl:function(){return'<div id="##" class="edui-box %%"></div>'}};Sc.inherits(Qb,Tc);var Uc=q.editor.utils,Vc=q.editor.dom.domUtils,Wc=q.editor.ui.UIBase,Xc=q.editor.ui.uiUtils,Rb=q.editor.ui.Mask=function(a){this.initOptions(a);this.initUIBase()};Rb.prototype={getHtmlTpl:function(){return'<div id="##" class="edui-mask %%" onmousedown="return $$._onMouseDown(event, this);"></div>'},postRender:function(){var a=this;Vc.on(window,"resize",function(){setTimeout(function(){a.isHidden()||
a._fill()})})},show:function(a){this._fill();this.getDom().style.display="";this.getDom().style.zIndex=a},hide:function(){this.getDom().style.display="none";this.getDom().style.zIndex=""},isHidden:function(){return"none"==this.getDom().style.display},_onMouseDown:function(){return!1},_fill:function(){var a=this.getDom(),b=Xc.getViewportRect();a.style.width=b.width+"px";a.style.height=b.height+"px"}};Uc.inherits(Rb,Wc);var Oa=function(a,b){for(var c=0;c<Na.length;c++){var d=Na[c];if(!d.isHidden()&&
!1!==d.queryAutoHide(b)){if(a&&/scroll/ig.test(a.type)&&"edui-wordpastepop"==d.className)break;d.hide()}}},Yc=q.editor.utils,ia=q.editor.ui.uiUtils,Pa=q.editor.dom.domUtils,Qa=q.editor.ui.UIBase,Ra=q.editor.ui.Popup=function(a){this.initOptions(a);this.initPopup()},Na=[];Ra.postHide=Oa;var Sb=["edui-anchor-topleft","edui-anchor-topright","edui-anchor-bottomleft","edui-anchor-bottomright"];Ra.prototype={SHADOW_RADIUS:5,content:null,_hidden:!1,autoRender:!0,canSideLeft:!0,canSideUp:!0,initPopup:function(){this.initUIBase();
Na.push(this)},getHtmlTpl:function(){return'<div id="##" class="edui-popup %%"> <div id="##_body" class="edui-popup-body"> <iframe style="position:absolute;z-index:-1;left:0;top:0;background-color: transparent;" frameborder="0" width="100%" height="100%" src="javascript:"></iframe> <div class="edui-shadow"></div> <div id="##_content" class="edui-popup-content">'+this.getContentHtmlTpl()+"  </div> </div></div>"},getContentHtmlTpl:function(){return this.content?"string"==typeof this.content?this.content:
this.content.renderHtml():""},_UIBase_postRender:Qa.prototype.postRender,postRender:function(){this.content instanceof Qa&&this.content.postRender();this.fireEvent("postRenderAfter");this.hide(!0);this._UIBase_postRender()},_doAutoRender:function(){!this.getDom()&&this.autoRender&&this.render()},mesureSize:function(){var a=this.getDom("content");return ia.getClientRect(a)},fitSize:function(){var a=this.getDom("body");a.style.width="";a.style.height="";var b=this.mesureSize();a.style.width=b.width+
"px";a.style.height=b.height+"px";return b},showAnchor:function(a,b){this.showAnchorRect(ia.getClientRect(a),b)},showAnchorRect:function(a,b){this._doAutoRender();var c=ia.getViewportRect();this._show();var d=this.fitSize(),e,f;b?(e=this.canSideLeft&&a.right+d.width>c.right&&a.left>d.width,c=this.canSideUp&&a.top+d.height>c.bottom&&a.bottom>d.height,f=e?a.left-d.width:a.right,d=c?a.bottom-d.height:a.top):(e=this.canSideLeft&&a.right+d.width>c.right&&a.left>d.width,c=this.canSideUp&&a.top+d.height>
c.bottom&&a.bottom>d.height,f=e?a.right-d.width:a.left,d=c?a.top-d.height:a.bottom);var h=this.getDom();ia.setViewportOffset(h,{left:f,top:d});Pa.removeClasses(h,Sb);h.className+=" "+Sb[2*(c?1:0)+(e?1:0)];this.editor&&(h.style.zIndex=1*this.editor.container.style.zIndex+10,q.editor.ui.uiUtils.getFixedLayer().style.zIndex=h.style.zIndex-1)},showAt:function(a){var b=a.left;a=a.top;this.showAnchorRect({left:b,top:a,right:b,bottom:a,height:0,width:0},!1,!0)},_show:function(){this._hidden&&(this.getDom().style.display=
"",this._hidden=!1,this.fireEvent("show"))},isHidden:function(){return this._hidden},show:function(){this._doAutoRender();this._show()},hide:function(a){!this._hidden&&this.getDom()&&(this.getDom().style.display="none",this._hidden=!0,a||this.fireEvent("hide"))},queryAutoHide:function(a){return!a||!ia.contains(this.getDom(),a)}};Yc.inherits(Ra,Qa);Pa.on(document,"mousedown",function(a){Oa(a,a.target||a.srcElement)});Pa.on(window,"scroll",function(a,b){Oa(a,b)});var Zc=q.editor.utils,$c=q.editor.ui.UIBase,
Tb=q.editor.ui.ColorPicker=function(a){this.initOptions(a);this.noColorText=this.noColorText||this.editor.getLang("clearColor");this.initUIBase()};Tb.prototype={getHtmlTpl:function(){for(var a=this.editor,b='<div id="##" class="edui-colorpicker %%"><div class="edui-colorpicker-topbar edui-clearfix"><div unselectable="on" id="##_preview" class="edui-colorpicker-preview"></div><div unselectable="on" class="edui-colorpicker-nocolor" onclick="$$._onPickNoColor(event, this);">'+this.noColorText+'</div></div><table  class="edui-box" style="border-collapse: collapse;" onmouseover="$$._onTableOver(event, this);" onmouseout="$$._onTableOut(event, this);" onclick="return $$._onTableClick(event, this);" cellspacing="0" cellpadding="0"><tr style="border-bottom: 1px solid #ddd;font-size: 13px;line-height: 25px;color:#39C;padding-top: 2px"><td colspan="10">'+
a.getLang("themeColor")+'</td> </tr><tr class="edui-colorpicker-tablefirstrow" >',c=0;c<wa.length;c++)c&&0===c%10&&(b+="</tr>"+(60==c?'<tr style="border-bottom: 1px solid #ddd;font-size: 13px;line-height: 25px;color:#39C;"><td colspan="10">'+a.getLang("standardColor")+"</td></tr>":"")+"<tr"+(60==c?' class="edui-colorpicker-tablefirstrow"':"")+">"),b+=70>c?'<td style="padding: 0 2px;"><a hidefocus title="'+wa[c]+'" onclick="return false;" href="javascript:" unselectable="on" class="edui-box edui-colorpicker-colorcell" data-color="#'+
wa[c]+'" style="background-color:#'+wa[c]+";border:solid #ccc;"+(10>c||60<=c?"border-width:1px;":10<=c&&20>c?"border-width:1px 1px 0 1px;":"border-width:0 1px 0 1px;")+'"></a></td>':"";return b+"</tr></table></div>"},_onTableClick:function(a){(a=(a.target||a.srcElement).getAttribute("data-color"))&&this.fireEvent("pickcolor",a)},_onTableOver:function(a){if(a=(a.target||a.srcElement).getAttribute("data-color"))this.getDom("preview").style.backgroundColor=a},_onTableOut:function(){this.getDom("preview").style.backgroundColor=
""},_onPickNoColor:function(){this.fireEvent("picknocolor")}};Zc.inherits(Tb,$c);var wa="ffffff 000000 eeece1 1f497d 4f81bd c0504d 9bbb59 8064a2 4bacc6 f79646 f2f2f2 7f7f7f ddd9c3 c6d9f0 dbe5f1 f2dcdb ebf1dd e5e0ec dbeef3 fdeada d8d8d8 595959 c4bd97 8db3e2 b8cce4 e5b9b7 d7e3bc ccc1d9 b7dde8 fbd5b5 bfbfbf 3f3f3f 938953 548dd4 95b3d7 d99694 c3d69b b2a2c7 92cddc fac08f a5a5a5 262626 494429 17365d 366092 953734 76923c 5f497a 31859b e36c09 7f7f7f 0c0c0c 1d1b10 0f243e 244061 632423 4f6128 3f3151 205867 974806 c00000 ff0000 ffc000 ffff00 92d050 00b050 00b0f0 0070c0 002060 7030a0 ".split(" "),
ad=q.editor.utils,Sa=q.editor.ui.uiUtils,Ub=q.editor.ui.UIBase,Vb=q.editor.ui.TablePicker=function(a){this.initOptions(a);this.initTablePicker()};Vb.prototype={defaultNumRows:10,defaultNumCols:10,maxNumRows:20,maxNumCols:20,numRows:10,numCols:10,lengthOfCellSide:22,initTablePicker:function(){this.initUIBase()},getHtmlTpl:function(){return'<div id="##" class="edui-tablepicker %%"><div class="edui-tablepicker-body"><div class="edui-infoarea"><span id="##_label" class="edui-label"></span></div><div class="edui-pickarea" onmousemove="$$._onMouseMove(event, this);" onmouseover="$$._onMouseOver(event, this);" onmouseout="$$._onMouseOut(event, this);" onclick="$$._onClick(event, this);"><div id="##_overlay" class="edui-overlay"></div></div></div></div>'},
_UIBase_render:Ub.prototype.render,render:function(a){this._UIBase_render(a);this.getDom("label").innerHTML="0"+this.editor.getLang("t_row")+" x 0"+this.editor.getLang("t_col")},_track:function(a,b){var c=this.getDom("overlay").style,d=this.lengthOfCellSide;c.width=a*d+"px";c.height=b*d+"px";this.getDom("label").innerHTML=a+this.editor.getLang("t_col")+" x "+b+this.editor.getLang("t_row");this.numCols=a;this.numRows=b},_onMouseOver:function(a,b){var c=a.relatedTarget||a.fromElement;!Sa.contains(b,
c)&&b!==c&&(this.getDom("label").innerHTML="0"+this.editor.getLang("t_col")+" x 0"+this.editor.getLang("t_row"),this.getDom("overlay").style.visibility="")},_onMouseOut:function(a,b){var c=a.relatedTarget||a.toElement;!Sa.contains(b,c)&&b!==c&&(this.getDom("label").innerHTML="0"+this.editor.getLang("t_col")+" x 0"+this.editor.getLang("t_row"),this.getDom("overlay").style.visibility="hidden")},_onMouseMove:function(a){this.getDom("overlay");var b=Sa.getEventOffset(a),c=this.lengthOfCellSide;a=Math.ceil(b.left/
c);b=Math.ceil(b.top/c);this._track(a,b)},_onClick:function(){this.fireEvent("picktable",this.numCols,this.numRows)}};ad.inherits(Vb,Ub);var Wb=q.editor.dom.domUtils,Xb=q.editor.ui.uiUtils,bd='onmousedown="$$.Stateful_onMouseDown(event, this);" onmouseup="$$.Stateful_onMouseUp(event, this);"'+(q.editor.browser.ie?' onmouseenter="$$.Stateful_onMouseEnter(event, this);" onmouseleave="$$.Stateful_onMouseLeave(event, this);"':' onmouseover="$$.Stateful_onMouseOver(event, this);" onmouseout="$$.Stateful_onMouseOut(event, this);"');
q.editor.ui.Stateful={alwalysHoverable:!1,target:null,Stateful_init:function(){this._Stateful_dGetHtmlTpl=this.getHtmlTpl;this.getHtmlTpl=this.Stateful_getHtmlTpl},Stateful_getHtmlTpl:function(){return this._Stateful_dGetHtmlTpl().replace(/stateful/g,function(){return bd})},Stateful_onMouseEnter:function(a,b){this.target=b;if(!this.isDisabled()||this.alwalysHoverable)this.addState("hover"),this.fireEvent("over")},Stateful_onMouseLeave:function(){if(!this.isDisabled()||this.alwalysHoverable)this.removeState("hover"),
this.removeState("active"),this.fireEvent("out")},Stateful_onMouseOver:function(a,b){var c=a.relatedTarget;!Xb.contains(b,c)&&b!==c&&this.Stateful_onMouseEnter(a,b)},Stateful_onMouseOut:function(a,b){var c=a.relatedTarget;!Xb.contains(b,c)&&b!==c&&this.Stateful_onMouseLeave(a,b)},Stateful_onMouseDown:function(){this.isDisabled()||this.addState("active")},Stateful_onMouseUp:function(){this.isDisabled()||this.removeState("active")},Stateful_postRender:function(){this.disabled&&!this.hasState("disabled")&&
this.addState("disabled")},hasState:function(a){return Wb.hasClass(this.getStateDom(),"edui-state-"+a)},addState:function(a){this.hasState(a)||(this.getStateDom().className+=" edui-state-"+a)},removeState:function(a){this.hasState(a)&&Wb.removeClasses(this.getStateDom(),["edui-state-"+a])},getStateDom:function(){return this.getDom("state")},isChecked:function(){return this.hasState("checked")},setChecked:function(a){!this.isDisabled()&&a?this.addState("checked"):this.removeState("checked")},isDisabled:function(){return this.hasState("disabled")},
setDisabled:function(a){a?(this.removeState("hover"),this.removeState("checked"),this.removeState("active"),this.addState("disabled")):this.removeState("disabled")}};var Yb=q.editor.utils,cd=q.editor.ui.UIBase,dd=q.editor.ui.Stateful,Ta=q.editor.ui.Button=function(a){this.initOptions(a);this.initButton()};Ta.prototype={uiName:"button",label:"",title:"",showIcon:!0,showText:!0,initButton:function(){this.initUIBase();this.Stateful_init()},getHtmlTpl:function(){return'<div id="##" class="edui-box %%"><div id="##_state" stateful><div class="%%-wrap"><div id="##_body" unselectable="on" '+
(this.title?'title="'+this.title+'"':"")+' class="%%-body" onmousedown="return false;" onclick="return $$._onClick();">'+(this.showIcon?'<div class="edui-box edui-icon"></div>':"")+(this.showText?'<div class="edui-box edui-label">'+this.label+"</div>":"")+"</div></div></div></div>"},postRender:function(){this.Stateful_postRender();this.setDisabled(this.disabled)},_onClick:function(){this.isDisabled()||this.fireEvent("click")}};Yb.inherits(Ta,cd);Yb.extend(Ta.prototype,dd);var ja=q.editor.utils,Ua=
q.editor.ui.uiUtils,Zb=q.editor.ui.UIBase,ed=q.editor.ui.Stateful,Va=q.editor.ui.SplitButton=function(a){this.initOptions(a);this.initSplitButton()};Va.prototype={popup:null,uiName:"splitbutton",title:"",initSplitButton:function(){this.initUIBase();this.Stateful_init();if(null!=this.popup){var a=this.popup;this.popup=null;this.setPopup(a)}},_UIBase_postRender:Zb.prototype.postRender,postRender:function(){this.Stateful_postRender();this._UIBase_postRender()},setPopup:function(a){this.popup!==a&&(null!=
this.popup&&this.popup.dispose(),a.addListener("show",ja.bind(this._onPopupShow,this)),a.addListener("hide",ja.bind(this._onPopupHide,this)),a.addListener("postrender",ja.bind(function(){a.getDom("body").appendChild(Ua.createElementByHtml('<div id="'+this.popup.id+'_bordereraser" class="edui-bordereraser edui-background" style="width:'+(Ua.getClientRect(this.getDom()).width-2)+'px"></div>'));a.getDom().className+=" "+this.className},this)),this.popup=a)},_onPopupShow:function(){this.addState("opened")},
_onPopupHide:function(){this.removeState("opened")},getHtmlTpl:function(){return'<div id="##" class="edui-box %%"><div '+(this.title?'title="'+this.title+'"':"")+' id="##_state" stateful><div class="%%-body"><div id="##_button_body" class="edui-box edui-button-body" onclick="$$._onButtonClick(event, this);"><div class="edui-box edui-icon"></div></div><div class="edui-box edui-splitborder"></div><div class="edui-box edui-arrow" onclick="$$._onArrowClick();"></div></div></div></div>'},showPopup:function(){var a=
Ua.getClientRect(this.getDom());a.top-=this.popup.SHADOW_RADIUS;a.height+=this.popup.SHADOW_RADIUS;this.popup.showAnchorRect(a)},_onArrowClick:function(){this.isDisabled()||this.showPopup()},_onButtonClick:function(){this.isDisabled()||this.fireEvent("buttonclick")}};ja.inherits(Va,Zb);ja.extend(Va.prototype,ed,!0);var fd=q.editor.utils,gd=q.editor.ui.uiUtils,hd=q.editor.ui.ColorPicker,id=q.editor.ui.Popup,$b=q.editor.ui.SplitButton,ac=q.editor.ui.ColorButton=function(a){this.initOptions(a);this.initColorButton()};
ac.prototype={initColorButton:function(){var a=this;this.popup=new id({content:new hd({noColorText:a.editor.getLang("clearColor"),editor:a.editor,onpickcolor:function(b,c){a._onPickColor(c)},onpicknocolor:function(b,c){a._onPickNoColor(c)}}),editor:a.editor});this.initSplitButton()},_SplitButton_postRender:$b.prototype.postRender,postRender:function(){this._SplitButton_postRender();this.getDom("button_body").appendChild(gd.createElementByHtml('<div id="'+this.id+'_colorlump" class="edui-colorlump"></div>'));
this.getDom().className+=" edui-colorbutton"},setColor:function(a){this.color=this.getDom("colorlump").style.backgroundColor=a},_onPickColor:function(a){!1!==this.fireEvent("pickcolor",a)&&(this.setColor(a),this.popup.hide())},_onPickNoColor:function(){!1!==this.fireEvent("picknocolor")&&this.popup.hide()}};fd.inherits(ac,$b);var jd=q.editor.utils,kd=q.editor.ui.Popup,ld=q.editor.ui.TablePicker,md=q.editor.ui.SplitButton,bc=q.editor.ui.TableButton=function(a){this.initOptions(a);this.initTableButton()};
bc.prototype={initTableButton:function(){var a=this;this.popup=new kd({content:new ld({editor:a.editor,onpicktable:function(b,c,d){a._onPickTable(c,d)}}),editor:a.editor});this.initSplitButton()},_onPickTable:function(a,b){!1!==this.fireEvent("picktable",a,b)&&this.popup.hide()}};jd.inherits(bc,md);var nd=q.editor.utils,cc=q.editor.ui.UIBase,dc=q.editor.ui.AutoTypeSetPicker=function(a){this.initOptions(a);this.initAutoTypeSetPicker()};dc.prototype={initAutoTypeSetPicker:function(){this.initUIBase()},
getHtmlTpl:function(){var a=this.editor,b=a.options.autotypeset,c=a.getLang("autoTypeSet"),d="textAlignValue"+a.uid,e="imageBlockLineValue"+a.uid;return'<div id="##" class="edui-autotypesetpicker %%"><div class="edui-autotypesetpicker-body"><table ><tr><td nowrap colspan="2"><input type="checkbox" name="mergeEmptyline" '+(b.mergeEmptyline?"checked":"")+">"+c.mergeLine+'</td><td colspan="2"><input type="checkbox" name="removeEmptyline" '+(b.removeEmptyline?"checked":"")+">"+c.delLine+'</td></tr><tr><td nowrap colspan="2"><input type="checkbox" name="removeClass" '+
(b.removeClass?"checked":"")+">"+c.removeFormat+'</td><td colspan="2"><input type="checkbox" name="indent" '+(b.indent?"checked":"")+">"+c.indent+'</td></tr><tr><td nowrap colspan="2"><input type="checkbox" name="textAlign" '+(b.textAlign?"checked":"")+">"+c.alignment+'</td><td colspan="2" id="'+d+'"><input type="radio" name="'+d+'" value="left" '+(b.textAlign&&"left"==b.textAlign?"checked":"")+">"+a.getLang("justifyleft")+'<input type="radio" name="'+d+'" value="center" '+(b.textAlign&&"center"==
b.textAlign?"checked":"")+">"+a.getLang("justifycenter")+'<input type="radio" name="'+d+'" value="right" '+(b.textAlign&&"right"==b.textAlign?"checked":"")+">"+a.getLang("justifyright")+' </tr><tr><td nowrap colspan="2"><input type="checkbox" name="imageBlockLine" '+(b.imageBlockLine?"checked":"")+">"+c.imageFloat+'</td><td nowrap colspan="2" id="'+e+'"><input type="radio" name="'+e+'" value="none" '+(b.imageBlockLine&&"none"==b.imageBlockLine?"checked":"")+">"+a.getLang("default")+'<input type="radio" name="'+
e+'" value="left" '+(b.imageBlockLine&&"left"==b.imageBlockLine?"checked":"")+">"+a.getLang("justifyleft")+'<input type="radio" name="'+e+'" value="center" '+(b.imageBlockLine&&"center"==b.imageBlockLine?"checked":"")+">"+a.getLang("justifycenter")+'<input type="radio" name="'+e+'" value="right" '+(b.imageBlockLine&&"right"==b.imageBlockLine?"checked":"")+">"+a.getLang("justifyright")+'</tr><tr><td nowrap colspan="2"><input type="checkbox" name="clearFontSize" '+(b.clearFontSize?"checked":"")+">"+
c.removeFontsize+'</td><td colspan="2"><input type="checkbox" name="clearFontFamily" '+(b.clearFontFamily?"checked":"")+">"+c.removeFontFamily+'</td></tr><tr><td nowrap colspan="4"><input type="checkbox" name="removeEmptyNode" '+(b.removeEmptyNode?"checked":"")+">"+c.removeHtml+'</td></tr><tr><td nowrap colspan="4"><input type="checkbox" name="pasteFilter" '+(b.pasteFilter?"checked":"")+">"+c.pasteFilter+'</td></tr><tr><td nowrap colspan="4" align="right"><button >'+c.run+"</button></td></tr></table></div></div>"},
_UIBase_render:cc.prototype.render};nd.inherits(dc,cc);var ec=function(a){for(var b=a.editor.options.autotypeset,c=a.getDom(),d=a.editor.uid,e=null,e=null,g=f.getElementsByTagName(c,"input"),h=g.length-1,j;j=g[h--];)if(e=j.getAttribute("type"),"checkbox"==e&&(e=j.getAttribute("name"),b[e]&&delete b[e],j.checked))if(j=document.getElementById(e+"Value"+d))if(/input/ig.test(j.tagName))b[e]=j.value;else{j=j.getElementsByTagName("input");for(var l=j.length-1,k;k=j[l--];)if(k.checked){b[e]=k.value;break}}else b[e]=
!0;c=f.getElementsByTagName(c,"select");for(h=0;d=c[h++];)g=d.getAttribute("name"),b[g]=b[g]?d.value:"";a.editor.options.autotypeset=b},od=q.editor.utils,pd=q.editor.ui.Popup,qd=q.editor.ui.AutoTypeSetPicker,rd=q.editor.ui.SplitButton,fc=q.editor.ui.AutoTypeSetButton=function(a){this.initOptions(a);this.initAutoTypeSetButton()};fc.prototype={initAutoTypeSetButton:function(){var a=this;this.popup=new pd({content:new qd({editor:a.editor}),editor:a.editor,hide:function(){!this._hidden&&this.getDom()&&
(ec(this),this.getDom().style.display="none",this._hidden=!0,this.fireEvent("hide"))}});var b=0;this.popup.addListener("postRenderAfter",function(){var c=this;b||(this.getDom().getElementsByTagName("button")[0].onclick=function(){ec(c);a.editor.execCommand("autotypeset");c.hide()},b=1)});this.initSplitButton()}};od.inherits(fc,rd);var gc=q.editor.utils,sd=q.editor.ui.Popup,td=q.editor.ui.Stateful,hc=q.editor.ui.UIBase,Wa=q.editor.ui.CellAlignPicker=function(a){this.initOptions(a);this.initSelected();
this.initCellAlignPicker()};Wa.prototype={initSelected:function(){var a={top:0,middle:1,bottom:2},b={left:0,center:1,right:2};this.selected&&(this.selectedIndex=3*a[this.selected.valign]+b[this.selected.align])},initCellAlignPicker:function(){this.initUIBase();this.Stateful_init()},getHtmlTpl:function(){for(var a=["left","center","right"],b=null,c=-1,d=[],e=0;9>e;e++)b=this.selectedIndex===e?' class="edui-cellalign-selected" ':"",c=e%3,0===c&&d.push("<tr>"),d.push('<td index="'+e+'" '+b+' stateful><div class="edui-icon edui-'+
a[c]+'"></div></td>'),2===c&&d.push("</tr>");return'<div id="##" class="edui-cellalignpicker %%"><div class="edui-cellalignpicker-body"><table onclick="$$._onClick(event);">'+d.join("")+"</table></div></div>"},getStateDom:function(){return this.target},_onClick:function(a){var b=a.target||a.srcElement;/icon/.test(b.className)&&(this.items[b.parentNode.getAttribute("index")].onclick(),sd.postHide(a))},_UIBase_render:hc.prototype.render};gc.inherits(Wa,hc);gc.extend(Wa.prototype,td,!0);var ic=q.editor.utils,
ud=q.editor.ui.Stateful,jc=q.editor.ui.uiUtils,kc=q.editor.ui.UIBase,Xa=q.editor.ui.PastePicker=function(a){this.initOptions(a);this.initPastePicker()};Xa.prototype={initPastePicker:function(){this.initUIBase();this.Stateful_init()},getHtmlTpl:function(){return'<div class="edui-pasteicon" onclick="$$._onClick(this)"></div><div class="edui-pastecontainer"><div class="edui-title">'+this.editor.getLang("pasteOpt")+'</div><div class="edui-button"><div title="'+this.editor.getLang("pasteSourceFormat")+
'" onclick="$$.format(false)" stateful><div class="edui-richtxticon"></div></div><div title="'+this.editor.getLang("tagFormat")+'" onclick="$$.format(2)" stateful><div class="edui-tagicon"></div></div><div title="'+this.editor.getLang("pasteTextFormat")+'" onclick="$$.format(true)" stateful><div class="edui-plaintxticon"></div></div></div></div></div>'},getStateDom:function(){return this.target},format:function(a){this.editor.ui._isTransfer=!0;this.editor.fireEvent("pasteTransfer",a)},_onClick:function(a){var b=
f.getNextDomNode(a),c=jc.getViewportRect().height,d=jc.getClientRect(b);b.style.top=d.top+d.height>c?-d.height-a.offsetHeight+"px":"";/hidden/ig.test(f.getComputedStyle(b,"visibility"))?(b.style.visibility="visible",f.addClass(a,"edui-state-opened")):(b.style.visibility="hidden",f.removeClasses(a,"edui-state-opened"))},_UIBase_render:kc.prototype.render};ic.inherits(Xa,kc);ic.extend(Xa.prototype,ud,!0);var vd=q.editor.utils,wd=q.editor.ui.uiUtils,xd=q.editor.ui.UIBase,lc=q.editor.ui.Toolbar=function(a){this.initOptions(a);
this.initToolbar()};lc.prototype={items:null,initToolbar:function(){this.items=this.items||[];this.initUIBase()},add:function(a){this.items.push(a)},getHtmlTpl:function(){for(var a=[],b=0;b<this.items.length;b++)a[b]=this.items[b].renderHtml();return'<div id="##" class="edui-toolbar %%" onselectstart="return false;" onmousedown="return $$._onMouseDown(event, this);">'+a.join("")+"</div>"},postRender:function(){for(var a=this.getDom(),b=0;b<this.items.length;b++)this.items[b].postRender();wd.makeUnselectable(a)},
_onMouseDown:function(){return!1}};vd.inherits(lc,xd);var Ya=q.editor.utils,xa=q.editor.dom.domUtils,ka=q.editor.ui.uiUtils,yd=q.editor.ui.UIBase,la=q.editor.ui.Popup,zd=q.editor.ui.Stateful,Ad=q.editor.ui.CellAlignPicker,ya=q.editor.ui.Menu=function(a){this.initOptions(a);this.initMenu()},Bd={renderHtml:function(){return'<div class="edui-menuitem edui-menuseparator"><div class="edui-menuseparator-inner"></div></div>'},postRender:function(){},queryAutoHide:function(){return!0}};ya.prototype={items:null,
uiName:"menu",initMenu:function(){this.items=this.items||[];this.initPopup();this.initItems()},initItems:function(){for(var a=0;a<this.items.length;a++){var b=this.items[a];"-"==b?this.items[a]=this.getSeparator():b instanceof ma||(b.editor=this.editor,b.theme=this.editor.options.theme,this.items[a]=this.createItem(b))}},getSeparator:function(){return Bd},createItem:function(a){a.menu=this;return new ma(a)},_Popup_getContentHtmlTpl:la.prototype.getContentHtmlTpl,getContentHtmlTpl:function(){if(0==
this.items.length)return this._Popup_getContentHtmlTpl();for(var a=[],b=0;b<this.items.length;b++)a[b]=this.items[b].renderHtml();return'<div class="%%-body">'+a.join("")+"</div>"},_Popup_postRender:la.prototype.postRender,postRender:function(){for(var a=this,b=0;b<this.items.length;b++){var c=this.items[b];c.ownerMenu=this;c.postRender()}xa.on(this.getDom(),"mouseover",function(b){b=b||event;b=b.relatedTarget||b.fromElement;var c=a.getDom();!ka.contains(c,b)&&c!==b&&a.fireEvent("over")});this._Popup_postRender()},
queryAutoHide:function(a){if(a){if(ka.contains(this.getDom(),a))return!1;for(var b=0;b<this.items.length;b++)if(!1===this.items[b].queryAutoHide(a))return!1}},clearItems:function(){for(var a=0;a<this.items.length;a++){var b=this.items[a];clearTimeout(b._showingTimer);clearTimeout(b._closingTimer);b.subMenu&&b.subMenu.destroy()}this.items=[]},destroy:function(){this.getDom()&&xa.remove(this.getDom());this.clearItems()},dispose:function(){this.destroy()}};Ya.inherits(ya,la);var ma=q.editor.ui.MenuItem=
function(a){this.initOptions(a);this.initUIBase();this.Stateful_init();if(this.subMenu&&!(this.subMenu instanceof ya))if(a.className&&-1!=a.className.indexOf("aligntd")){var b=this;this.subMenu.selected=this.editor.queryCommandValue("cellalignment");this.subMenu=new la({content:new Ad(this.subMenu),parentMenu:b,editor:b.editor,destroy:function(){this.getDom()&&xa.remove(this.getDom())}});this.subMenu.addListener("postRenderAfter",function(){xa.on(this.getDom(),"mouseover",function(){b.addState("opened")})})}else this.subMenu=
new ya(this.subMenu)};ma.prototype={label:"",subMenu:null,ownerMenu:null,uiName:"menuitem",alwalysHoverable:!0,getHtmlTpl:function(){return'<div id="##" class="%%" stateful onclick="$$._onClick(event, this);"><div class="%%-body">'+this.renderLabelHtml()+"</div></div>"},postRender:function(){var a=this;this.addListener("over",function(){a.ownerMenu.fireEvent("submenuover",a);a.subMenu&&a.delayShowSubMenu()});this.subMenu&&(this.getDom().className+=" edui-hassubmenu",this.subMenu.render(),this.addListener("out",
function(){a.delayHideSubMenu()}),this.subMenu.addListener("over",function(){clearTimeout(a._closingTimer);a._closingTimer=null;a.addState("opened")}),this.ownerMenu.addListener("hide",function(){a.hideSubMenu()}),this.ownerMenu.addListener("submenuover",function(b,c){c!==a&&a.delayHideSubMenu()}),this.subMenu._bakQueryAutoHide=this.subMenu.queryAutoHide,this.subMenu.queryAutoHide=function(b){return b&&ka.contains(a.getDom(),b)?!1:this._bakQueryAutoHide(b)});this.getDom().style.tabIndex="-1";ka.makeUnselectable(this.getDom());
this.Stateful_postRender()},delayShowSubMenu:function(){var a=this;a.isDisabled()||(a.addState("opened"),clearTimeout(a._showingTimer),clearTimeout(a._closingTimer),a._closingTimer=null,a._showingTimer=setTimeout(function(){a.showSubMenu()},250))},delayHideSubMenu:function(){var a=this;a.isDisabled()||(a.removeState("opened"),clearTimeout(a._showingTimer),a._closingTimer||(a._closingTimer=setTimeout(function(){a.hasState("opened")||a.hideSubMenu();a._closingTimer=null},400)))},renderLabelHtml:function(){return'<div class="edui-arrow"></div><div class="edui-box edui-icon"></div><div class="edui-box edui-label %%-label">'+
(this.label||"")+"</div>"},getStateDom:function(){return this.getDom()},queryAutoHide:function(a){if(this.subMenu&&this.hasState("opened"))return this.subMenu.queryAutoHide(a)},_onClick:function(a,b){this.hasState("disabled")||!1!==this.fireEvent("click",a,b)&&(this.subMenu?this.showSubMenu():la.postHide(a))},showSubMenu:function(){var a=ka.getClientRect(this.getDom());a.right-=5;a.left+=2;a.width-=7;a.top-=4;a.bottom+=4;a.height+=8;this.subMenu.showAnchorRect(a,!0,!0)},hideSubMenu:function(){this.subMenu.hide()}};
Ya.inherits(ma,yd);Ya.extend(ma.prototype,zd,!0);var Cd=q.editor.utils,Dd=q.editor.ui.uiUtils,Ed=q.editor.ui.Menu,mc=q.editor.ui.SplitButton,nc=q.editor.ui.Combox=function(a){this.initOptions(a);this.initCombox()};nc.prototype={uiName:"combox",initCombox:function(){var a=this;this.items=this.items||[];for(var b=0;b<this.items.length;b++){var c=this.items[b];c.uiName="listitem";c.index=b;c.onclick=function(){a.selectByIndex(this.index)}}this.popup=new Ed({items:this.items,uiName:"list",editor:this.editor});
this.initSplitButton()},_SplitButton_postRender:mc.prototype.postRender,postRender:function(){this._SplitButton_postRender();this.setLabel(this.label||"");this.setValue(this.initValue||"")},showPopup:function(){var a=Dd.getClientRect(this.getDom());a.top+=1;a.bottom-=1;a.height-=2;this.popup.showAnchorRect(a)},getValue:function(){return this.value},setValue:function(a){var b=this.indexByValue(a);-1!=b?(this.selectedIndex=b,this.setLabel(this.items[b].label),this.value=this.items[b].value):(this.selectedIndex=
-1,this.setLabel(this.getLabelForUnknowValue(a)),this.value=a)},setLabel:function(a){this.label=this.getDom("button_body").innerHTML=a},getLabelForUnknowValue:function(a){return a},indexByValue:function(a){for(var b=0;b<this.items.length;b++)if(a==this.items[b].value)return b;return-1},getItem:function(a){return this.items[a]},selectByIndex:function(a){a<this.items.length&&!1!==this.fireEvent("select",a)&&(this.selectedIndex=a,this.value=this.items[a].value,this.setLabel(this.items[a].label))}};Cd.inherits(nc,
mc);var oc=q.editor.utils,S=q.editor.dom.domUtils,T=q.editor.ui.uiUtils,pc=q.editor.ui.Mask,Fd=q.editor.ui.UIBase,Za=q.editor.ui.Button,qc=q.editor.ui.Dialog=function(a){this.initOptions(oc.extend({autoReset:!0,draggable:!0,onok:function(){},oncancel:function(){},onclose:function(a,c){return c?this.onok():this.oncancel()},holdScroll:!1},a));this.initDialog()},rc,sc;qc.prototype={draggable:!1,uiName:"dialog",initDialog:function(){var a=this,b=this.editor.options.theme;this.initUIBase();this.modalMask=
rc||(rc=new pc({className:"edui-dialog-modalmask",theme:b}));this.dragMask=sc||(sc=new pc({className:"edui-dialog-dragmask",theme:b}));this.closeButton=new Za({className:"edui-dialog-closebutton",title:a.closeDialog,theme:b,onclick:function(){a.close(!1)}});if(this.buttons)for(b=0;b<this.buttons.length;b++)this.buttons[b]instanceof Za||(this.buttons[b]=new Za(this.buttons[b]))},fitSize:function(){var a=this.getDom("body"),b=this.mesureSize();a.style.width=b.width+"px";a.style.height=b.height+"px";
return b},safeSetOffset:function(a){var b=this.getDom(),c=T.getViewportRect(),d=T.getClientRect(b),e=a.left;e+d.width>c.right&&(e=c.right-d.width);a=a.top;a+d.height>c.bottom&&(a=c.bottom-d.height);b.style.left=Math.max(e,0)+"px";b.style.top=Math.max(a,0)+"px"},showAtCenter:function(){this.getDom().style.display="";var a=T.getViewportRect(),b=this.fitSize(),c=this.getDom("titlebar").offsetHeight|0,d=a.width/2-b.width/2,a=a.height/2-(b.height-c)/2-c,b=this.getDom();this.safeSetOffset({left:Math.max(d|
0,0),top:Math.max(a|0,0)});S.hasClass(b,"edui-state-centered")||(b.className+=" edui-state-centered");this._show()},getContentHtml:function(){var a="";"string"==typeof this.content?a=this.content:this.iframeUrl&&(a='<span id="'+this.id+'_contmask" class="dialogcontmask"></span><iframe id="'+this.id+'_iframe" class="%%-iframe" height="100%" width="100%" frameborder="0" src="'+this.iframeUrl+'"></iframe>');return a},getHtmlTpl:function(){var a="";if(this.buttons){for(var a=[],b=0;b<this.buttons.length;b++)a[b]=
this.buttons[b].renderHtml();a='<div class="%%-foot"><div id="##_buttons" class="%%-buttons">'+a.join("")+"</div></div>"}return'<div id="##" class="%%"><div class="%%-wrap"><div id="##_body" class="%%-body"><div class="%%-shadow"></div><div id="##_titlebar" class="%%-titlebar"><div class="%%-draghandle" onmousedown="$$._onTitlebarMouseDown(event, this);"><span class="%%-caption">'+(this.title||"")+"</span></div>"+this.closeButton.renderHtml()+'</div><div id="##_content" class="%%-content">'+(this.autoReset?
"":this.getContentHtml())+"</div>"+a+"</div></div></div>"},postRender:function(){this.modalMask.getDom()||(this.modalMask.render(),this.modalMask.hide());this.dragMask.getDom()||(this.dragMask.render(),this.dragMask.hide());var a=this;this.addListener("show",function(){a.modalMask.show(this.getDom().style.zIndex-2)});this.addListener("hide",function(){a.modalMask.hide()});if(this.buttons)for(var b=0;b<this.buttons.length;b++)this.buttons[b].postRender();S.on(window,"resize",function(){setTimeout(function(){a.isHidden()||
a.safeSetOffset(T.getClientRect(a.getDom()))})});if(this.holdScroll)if(a.iframeUrl)a.addListener("dialogafterreset",function(){window.setTimeout(function(){var b=document.getElementById(a.id+"_iframe").contentWindow;if(n.ie)var d=window.setInterval(function(){b.document&&b.document.body&&(window.clearInterval(d),d=null,S.on(b.document.body,!n.gecko?"mousewheel":"DOMMouseScroll",function(a){S.preventDefault(a)}))},100);else S.on(b,!n.gecko?"mousewheel":"DOMMouseScroll",function(a){S.preventDefault(a)})},
1)});else S.on(document.getElementById(a.id+"_iframe"),!n.gecko?"mousewheel":"DOMMouseScroll",function(a){S.preventDefault(a)});this._hide()},mesureSize:function(){var a=this.getDom("body"),b=T.getClientRect(this.getDom("content")).width;a.style.width=b;return T.getClientRect(a)},_onTitlebarMouseDown:function(a){if(this.draggable){var b;T.getViewportRect();var c=this;T.startDrag(a,{ondragstart:function(){b=T.getClientRect(c.getDom());c.getDom("contmask").style.visibility="visible";c.dragMask.show(c.getDom().style.zIndex-
1)},ondragmove:function(a,e){c.safeSetOffset({left:b.left+a,top:b.top+e})},ondragstop:function(){c.getDom("contmask").style.visibility="hidden";S.removeClasses(c.getDom(),["edui-state-centered"]);c.dragMask.hide()}})}},reset:function(){this.getDom("content").innerHTML=this.getContentHtml();this.fireEvent("dialogafterreset")},_show:function(){this._hidden&&(this.getDom().style.display="",this.editor.container.style.zIndex&&(this.getDom().style.zIndex=1*this.editor.container.style.zIndex+10),this._hidden=
!1,this.fireEvent("show"),q.editor.ui.uiUtils.getFixedLayer().style.zIndex=this.getDom().style.zIndex-4)},isHidden:function(){return this._hidden},_hide:function(){this._hidden||(this.getDom().style.display="none",this.getDom().style.zIndex="",this._hidden=!0,this.fireEvent("hide"))},open:function(){if(this.autoReset)try{this.reset()}catch(a){this.render(),this.open()}this.showAtCenter();if(this.iframeUrl)try{this.getDom("iframe").focus()}catch(b){}},_onCloseButtonClick:function(){this.close(!1)},
close:function(a){!1!==this.fireEvent("close",a)&&this._hide()}};oc.inherits(qc,Fd);var Gd=q.editor.utils,Hd=q.editor.ui.Menu,Id=q.editor.ui.SplitButton,tc=q.editor.ui.MenuButton=function(a){this.initOptions(a);this.initMenuButton()};tc.prototype={initMenuButton:function(){var a=this;this.uiName="menubutton";this.popup=new Hd({items:a.items,className:a.className,editor:a.editor});this.popup.addListener("show",function(){for(var b=0;b<this.items.length;b++)this.items[b].removeState("checked"),this.items[b].value==
a._value&&(this.items[b].addState("checked"),this.value=a._value)});this.initSplitButton()},setValue:function(a){this._value=a}};Gd.inherits(tc,Id);var za=q.editor.utils,y=q.editor.ui,Jd=y.Dialog;y.buttons={};y.Dialog=function(a){var b=new Jd(a);b.addListener("hide",function(){if(b.editor){var a=b.editor;try{if(n.gecko){var d=a.window.scrollY,e=a.window.scrollX;a.body.focus();a.window.scrollTo(e,d)}else a.focus()}catch(f){}}});return b};for(var $a={anchor:"~/dialogs/anchor/anchor.html",insertimage:"~/dialogs/image/image.html",
link:"~/dialogs/link/link.html",spechars:"~/dialogs/spechars/spechars.html",searchreplace:"~/dialogs/searchreplace/searchreplace.html",map:"~/dialogs/map/map.html",gmap:"~/dialogs/gmap/gmap.html",insertvideo:"~/dialogs/video/video.html",help:"~/dialogs/help/help.html",emotion:"~/dialogs/emotion/emotion.html",wordimage:"~/dialogs/wordimage/wordimage.html",attachment:"~/dialogs/attachment/attachment.html",insertframe:"~/dialogs/insertframe/insertframe.html",edittip:"~/dialogs/table/edittip.html",edittable:"~/dialogs/table/edittable.html",
edittd:"~/dialogs/table/edittd.html",webapp:"~/dialogs/webapp/webapp.html",snapscreen:"~/dialogs/snapscreen/snapscreen.html",scrawl:"~/dialogs/scrawl/scrawl.html",music:"~/dialogs/music/music.html",template:"~/dialogs/template/template.html",background:"~/dialogs/background/background.html"},Kd="undo redo formatmatch bold italic underline fontborder touppercase tolowercase strikethrough subscript superscript source indent outdent blockquote pasteplain pagebreak selectall print preview horizontal removeformat time date unlink insertparagraphbeforetable insertrow insertcol mergeright mergedown deleterow deletecol splittorows splittocols splittocells mergecells deletetable".split(" "),
ab=0,W;W=Kd[ab++];)W=W.toLowerCase(),y[W]=function(a){return function(b){var c=new y.Button({className:"edui-for-"+a,title:b.options.labelMap[a]||b.getLang("labelMap."+a)||"",onclick:function(){b.execCommand(a)},theme:b.options.theme,showText:!1});y.buttons[a]=c;b.addListener("selectionchange",function(d,e,f){d=b.queryCommandState(a);-1==d?(c.setDisabled(!0),c.setChecked(!1)):f||(c.setDisabled(!1),c.setChecked(d))});return c}}(W);y.cleardoc=function(a){var b=new y.Button({className:"edui-for-cleardoc",
title:a.options.labelMap.cleardoc||a.getLang("labelMap.cleardoc")||"",theme:a.options.theme,onclick:function(){confirm(a.getLang("confirmClear"))&&a.execCommand("cleardoc")}});y.buttons.cleardoc=b;a.addListener("selectionchange",function(){b.setDisabled(-1==a.queryCommandState("cleardoc"))});return b};var uc={justify:["left","right","center","justify"],imagefloat:["none","left","center","right"],directionality:["ltr","rtl"]},da;for(da in uc)(function(a,b){for(var c=0,d;d=b[c++];)(function(b){y[a.replace("float",
"")+b]=function(c){var d=new y.Button({className:"edui-for-"+a.replace("float","")+b,title:c.options.labelMap[a.replace("float","")+b]||c.getLang("labelMap."+a.replace("float","")+b)||"",theme:c.options.theme,onclick:function(){c.execCommand(a,b)}});y.buttons[a]=d;c.addListener("selectionchange",function(f,l,k){d.setDisabled(-1==c.queryCommandState(a));d.setChecked(c.queryCommandValue(a)==b&&!k)});return d}})(d)})(da,uc[da]);for(ab=0;W=["backcolor","forecolor"][ab++];)y[W]=function(a){return function(b){var c=
new y.ColorButton({className:"edui-for-"+a,color:"default",title:b.options.labelMap[a]||b.getLang("labelMap."+a)||"",editor:b,onpickcolor:function(c,e){b.execCommand(a,e)},onpicknocolor:function(){b.execCommand(a,"default");this.setColor("transparent");this.color="default"},onbuttonclick:function(){b.execCommand(a,this.color)}});y.buttons[a]=c;b.addListener("selectionchange",function(){c.setDisabled(-1==b.queryCommandState(a))});return c}}(W);var vc={noOk:["searchreplace","help","spechars","webapp"],
ok:"attachment anchor link insertimage map gmap insertframe wordimage insertvideo insertframe edittip edittable edittd scrawl template music background".split(" ")};for(da in vc)(function(a,b){for(var c=0,d;d=b[c++];)n.opera&&"searchreplace"===d||function(b){y[b]=function(c,d,f){d=d||(c.options.iframeUrlMap||{})[b]||$a[b];f=c.options.labelMap[b]||c.getLang("labelMap."+b)||"";var l;d&&(l=new y.Dialog(za.extend({iframeUrl:c.ui.mapUrl(d),editor:c,className:"edui-for-"+b,title:f,holdScroll:"insertimage"===
b,closeDialog:c.getLang("closeDialog")},"ok"==a?{buttons:[{className:"edui-okbutton",label:c.getLang("ok"),editor:c,onclick:function(){l.close(!0)}},{className:"edui-cancelbutton",label:c.getLang("cancel"),editor:c,onclick:function(){l.close(!1)}}]}:{})),c.ui._dialogs[b+"Dialog"]=l);var k=new y.Button({className:"edui-for-"+b,title:f,onclick:function(){if(l)switch(b){case "wordimage":c.execCommand("wordimage","word_img");c.word_img&&(l.render(),l.open());break;case "scrawl":-1!=c.queryCommandState("scrawl")&&
(l.render(),l.open());break;default:l.render(),l.open()}},theme:c.options.theme,disabled:"scrawl"==b&&-1==c.queryCommandState("scrawl")});y.buttons[b]=k;c.addListener("selectionchange",function(){if(!(b in{edittable:1})){var a=c.queryCommandState(b);k.getDom()&&(k.setDisabled(-1==a),k.setChecked(a))}});return k}}(d.toLowerCase())})(da,vc[da]);y.snapscreen=function(a,b,c){c=a.options.labelMap.snapscreen||a.getLang("labelMap.snapscreen")||"";var d=new y.Button({className:"edui-for-snapscreen",title:c,
onclick:function(){a.execCommand("snapscreen")},theme:a.options.theme});y.buttons.snapscreen=d;if(b=b||(a.options.iframeUrlMap||{}).snapscreen||$a.snapscreen){var e=new y.Dialog({iframeUrl:a.ui.mapUrl(b),editor:a,className:"edui-for-snapscreen",title:c,buttons:[{className:"edui-okbutton",label:a.getLang("ok"),editor:a,onclick:function(){e.close(!0)}},{className:"edui-cancelbutton",label:a.getLang("cancel"),editor:a,onclick:function(){e.close(!1)}}]});e.render();a.ui._dialogs.snapscreenDialog=e}a.addListener("selectionchange",
function(){d.setDisabled(-1==a.queryCommandState("snapscreen"))});return d};y.insertcode=function(a,b,c){b=a.options.insertcode||[];c=a.options.labelMap.insertcode||a.getLang("labelMap.insertcode")||"";var d=[];za.each(b,function(b,c){d.push({label:b,value:c,theme:a.options.theme,renderLabelHtml:function(){return'<div class="edui-label %%-label" >'+(this.label||"")+"</div>"}})});var e=new y.Combox({editor:a,items:d,onselect:function(b,c){a.execCommand("insertcode",this.items[c].value)},onbuttonclick:function(){this.showPopup()},
title:c,initValue:c,className:"edui-for-insertcode",indexByValue:function(a){if(a)for(var b=0,c;c=this.items[b];b++)if(-1!=c.value.indexOf(a))return b;return-1}});y.buttons.insertcode=e;a.addListener("selectionchange",function(b,d,f){f||(-1==a.queryCommandState("insertcode")?e.setDisabled(!0):(e.setDisabled(!1),(b=a.queryCommandValue("insertcode"))?(b&&(b=b.replace(/['"]/g,"").split(",")[0]),e.setValue(b)):e.setValue(c)))});return e};y.fontfamily=function(a,b,c){b=a.options.fontfamily||[];c=a.options.labelMap.fontfamily||
a.getLang("labelMap.fontfamily")||"";if(b.length){for(var d=0,e,f=[];e=b[d];d++){var h=a.getLang("fontfamily")[e.name]||"";(function(b,c){f.push({label:b,value:c,theme:a.options.theme,renderLabelHtml:function(){return'<div class="edui-label %%-label" style="font-family:'+za.unhtml(this.value)+'">'+(this.label||"")+"</div>"}})})(e.label||h,e.val)}var j=new y.Combox({editor:a,items:f,onselect:function(b,c){a.execCommand("FontFamily",this.items[c].value)},onbuttonclick:function(){this.showPopup()},title:c,
initValue:c,className:"edui-for-fontfamily",indexByValue:function(a){if(a)for(var b=0,c;c=this.items[b];b++)if(-1!=c.value.indexOf(a))return b;return-1}});y.buttons.fontfamily=j;a.addListener("selectionchange",function(b,c,d){d||(-1==a.queryCommandState("FontFamily")?j.setDisabled(!0):(j.setDisabled(!1),(b=a.queryCommandValue("FontFamily"))&&(b=b.replace(/['"]/g,"").split(",")[0]),j.setValue(b)))});return j}};y.fontsize=function(a,b,c){c=a.options.labelMap.fontsize||a.getLang("labelMap.fontsize")||
"";b=b||a.options.fontsize||[];if(b.length){for(var d=[],e=0;e<b.length;e++){var f=b[e]+"px";d.push({label:f,value:f,theme:a.options.theme,renderLabelHtml:function(){return'<div class="edui-label %%-label" style="line-height:1;font-size:'+this.value+'">'+(this.label||"")+"</div>"}})}var h=new y.Combox({editor:a,items:d,title:c,initValue:c,onselect:function(b,c){a.execCommand("FontSize",this.items[c].value)},onbuttonclick:function(){this.showPopup()},className:"edui-for-fontsize"});y.buttons.fontsize=
h;a.addListener("selectionchange",function(b,c,d){d||(-1==a.queryCommandState("FontSize")?h.setDisabled(!0):(h.setDisabled(!1),h.setValue(a.queryCommandValue("FontSize"))))});return h}};y.paragraph=function(a,b,c){c=a.options.labelMap.paragraph||a.getLang("labelMap.paragraph")||"";b=a.options.paragraph||[];if(!za.isEmptyObject(b)){var d=[],e;for(e in b)d.push({value:e,label:b[e]||a.getLang("paragraph")[e],theme:a.options.theme,renderLabelHtml:function(){return'<div class="edui-label %%-label"><span class="edui-for-'+
this.value+'">'+(this.label||"")+"</span></div>"}});var f=new y.Combox({editor:a,items:d,title:c,initValue:c,className:"edui-for-paragraph",onselect:function(b,c){a.execCommand("Paragraph",this.items[c].value)},onbuttonclick:function(){this.showPopup()}});y.buttons.paragraph=f;a.addListener("selectionchange",function(b,c,d){d||(-1==a.queryCommandState("Paragraph")?f.setDisabled(!0):(f.setDisabled(!1),b=a.queryCommandValue("Paragraph"),-1!=f.indexByValue(b)?f.setValue(b):f.setValue(f.initValue)))});
return f}};y.customstyle=function(a){var b=a.options.customstyle||[],c=a.options.labelMap.customstyle||a.getLang("labelMap.customstyle")||"";if(b.length){for(var d=a.getLang("customstyle"),e=0,f=[],h;h=b[e++];)(function(b){var c={};c.label=b.label?b.label:d[b.name];c.style=b.style;c.className=b.className;c.tag=b.tag;f.push({label:c.label,value:c,theme:a.options.theme,renderLabelHtml:function(){return'<div class="edui-label %%-label"><'+c.tag+" "+(c.className?' class="'+c.className+'"':"")+(c.style?
' style="'+c.style+'"':"")+">"+c.label+"</"+c.tag+"></div>"}})})(h);var j=new y.Combox({editor:a,items:f,title:c,initValue:c,className:"edui-for-customstyle",onselect:function(b,c){a.execCommand("customstyle",this.items[c].value)},onbuttonclick:function(){this.showPopup()},indexByValue:function(a){for(var b=0,c;c=this.items[b++];)if(c.label==a)return b-1;return-1}});y.buttons.customstyle=j;a.addListener("selectionchange",function(b,c,d){d||(-1==a.queryCommandState("customstyle")?j.setDisabled(!0):
(j.setDisabled(!1),b=a.queryCommandValue("customstyle"),-1!=j.indexByValue(b)?j.setValue(b):j.setValue(j.initValue)))});return j}};y.inserttable=function(a,b,c){c=a.options.labelMap.inserttable||a.getLang("labelMap.inserttable")||"";var d=new y.TableButton({editor:a,title:c,className:"edui-for-inserttable",onpicktable:function(b,c,d){a.execCommand("InsertTable",{numRows:d,numCols:c,border:1})},onbuttonclick:function(){this.showPopup()}});y.buttons.inserttable=d;a.addListener("selectionchange",function(){d.setDisabled(-1==
a.queryCommandState("inserttable"))});return d};y.lineheight=function(a){var b=a.options.lineheight||[];if(b.length){for(var c=0,d,e=[];d=b[c++];)e.push({label:d,value:d,theme:a.options.theme,onclick:function(){a.execCommand("lineheight",this.value)}});var f=new y.MenuButton({editor:a,className:"edui-for-lineheight",title:a.options.labelMap.lineheight||a.getLang("labelMap.lineheight")||"",items:e,onbuttonclick:function(){var b=a.queryCommandValue("LineHeight")||this.value;a.execCommand("LineHeight",
b)}});y.buttons.lineheight=f;a.addListener("selectionchange",function(){var b=a.queryCommandState("LineHeight");if(-1==b)f.setDisabled(!0);else{f.setDisabled(!1);var c=a.queryCommandValue("LineHeight");c&&f.setValue((c+"").replace(/cm/,""));f.setChecked(b)}});return f}};for(var Ld=["top","bottom"],Md=0,wc;wc=Ld[Md++];)(function(a){y["rowspacing"+a]=function(b){var c=b.options["rowspacing"+a]||[];if(!c.length)return null;for(var d=0,e,f=[];e=c[d++];)f.push({label:e,value:e,theme:b.options.theme,onclick:function(){b.execCommand("rowspacing",
this.value,a)}});var h=new y.MenuButton({editor:b,className:"edui-for-rowspacing"+a,title:b.options.labelMap["rowspacing"+a]||b.getLang("labelMap.rowspacing"+a)||"",items:f,onbuttonclick:function(){var c=b.queryCommandValue("rowspacing",a)||this.value;b.execCommand("rowspacing",c,a)}});y.buttons[a]=h;b.addListener("selectionchange",function(){var c=b.queryCommandState("rowspacing",a);if(-1==c)h.setDisabled(!0);else{h.setDisabled(!1);var d=b.queryCommandValue("rowspacing",a);d&&h.setValue((d+"").replace(/%/,
""));h.setChecked(c)}});return h}})(wc);for(var Nd=["insertorderedlist","insertunorderedlist"],Od=0,xc;xc=Nd[Od++];)(function(a){y[a]=function(b){var c=b.options[a],d=function(){b.execCommand(a,this.value)},e=[],f;for(f in c)e.push({label:c[f]||b.getLang()[a][f]||"",value:f,theme:b.options.theme,onclick:d});var h=new y.MenuButton({editor:b,className:"edui-for-"+a,title:b.getLang("labelMap."+a)||"",items:e,onbuttonclick:function(){var c=b.queryCommandValue(a)||this.value;b.execCommand(a,c)}});y.buttons[a]=
h;b.addListener("selectionchange",function(){var c=b.queryCommandState(a);if(-1==c)h.setDisabled(!0);else{h.setDisabled(!1);var d=b.queryCommandValue(a);h.setValue(d);h.setChecked(c)}});return h}})(xc);y.fullscreen=function(a,b){b=a.options.labelMap.fullscreen||a.getLang("labelMap.fullscreen")||"";var c=new y.Button({className:"edui-for-fullscreen",title:b,theme:a.options.theme,onclick:function(){a.ui&&a.ui.setFullScreen(!a.ui.isFullScreen());this.setChecked(a.ui.isFullScreen())}});y.buttons.fullscreen=
c;a.addListener("selectionchange",function(){var b=a.queryCommandState("fullscreen");c.setDisabled(-1==b);c.setChecked(a.ui.isFullScreen())});return c};y.emotion=function(a,b){var c=new y.MultiMenuPop({title:a.options.labelMap.emotion||a.getLang("labelMap.emotion")||"",editor:a,className:"edui-for-emotion",iframeUrl:a.ui.mapUrl(b||(a.options.iframeUrlMap||{}).emotion||$a.emotion)});y.buttons.emotion=c;a.addListener("selectionchange",function(){c.setDisabled(-1==a.queryCommandState("emotion"))});return c};
y.autotypeset=function(a){var b=new y.AutoTypeSetButton({editor:a,title:a.options.labelMap.autotypeset||a.getLang("labelMap.autotypeset")||"",className:"edui-for-autotypeset",onbuttonclick:function(){a.execCommand("autotypeset")}});y.buttons.autotypeset=b;a.addListener("selectionchange",function(){b.setDisabled(-1==a.queryCommandState("autotypeset"))});return b};var bb=function(a){this.initOptions(a);this.initEditorUI()},cb=q.editor.utils,yc=q.editor.ui.uiUtils,Pd=q.editor.ui.UIBase,H=q.editor.dom.domUtils,
zc=[];bb.prototype={uiName:"editor",initEditorUI:function(){function a(a,b){a.setOpt({wordCount:!0,maximumWords:1E4,wordCountMsg:a.options.wordCountMsg||a.getLang("wordCountMsg"),wordOverFlowMsg:a.options.wordOverFlowMsg||a.getLang("wordOverFlowMsg")});var c=a.options,d=c.maximumWords,e=c.wordCountMsg,f=c.wordOverFlowMsg,g=b.getDom("wordcount");c.wordCount&&(c=a.getContentLength(!0),c>d?(g.innerHTML=f,a.fireEvent("wordcountoverflow")):g.innerHTML=e.replace("{#leave}",d-c).replace("{#count}",c))}this.editor.ui=
this;this._dialogs={};this.initUIBase();this._initToolbars();var b=this.editor,c=this;b.addListener("ready",function(){b.getDialog=function(a){return b.ui._dialogs[a+"Dialog"]};H.on(b.window,"scroll",function(a){q.editor.ui.Popup.postHide(a)});b.ui._actualFrameWidth=b.options.initialFrameWidth;b.options.elementPathEnabled&&(b.ui.getDom("elementpath").innerHTML='<div class="edui-editor-breadcrumb">'+b.getLang("elementPathTip")+":</div>");b.options.wordCount&&(H.on(b.document,"click",function(){a(b,
c);H.un(b.document,"click",arguments.callee)}),b.ui.getDom("wordcount").innerHTML=b.getLang("wordCountTip"));b.ui._scale();b.options.scaleEnabled?(b.autoHeightEnabled&&b.disableAutoHeight(),c.enableScale()):c.disableScale();!b.options.elementPathEnabled&&(!b.options.wordCount&&!b.options.scaleEnabled)&&(b.ui.getDom("elementpath").style.display="none",b.ui.getDom("wordcount").style.display="none",b.ui.getDom("scale").style.display="none");b.selection.isFocus()&&b.fireEvent("selectionchange",!1,!0)});
b.addListener("mousedown",function(a,b){q.editor.ui.Popup.postHide(b,b.target||b.srcElement)});b.addListener("delcells",function(){UE.ui.edittip&&new UE.ui.edittip(b);b.getDialog("edittip").open()});var d,e=!1,f;b.addListener("afterpaste",function(){b.queryCommandState("pasteplain")||(d=new q.editor.ui.Popup({content:new q.editor.ui.PastePicker({editor:b}),editor:b,className:"edui-wordpastepop"}),d.render(),e=!0)});b.addListener("afterinserthtml",function(){clearTimeout(f);f=setTimeout(function(){if(d&&
(e||b.ui._isTransfer)){var a=H.createElement(b.document,"span",{style:"line-height:0px;",innerHTML:"\ufeff"});b.selection.getRange().insertNode(a);var c=Ba(a,"firstChild","previousSibling");d.showAnchor(3==c.nodeType?c.parentNode:c);H.remove(a);delete b.ui._isTransfer;e=!1}},200)});b.addListener("contextmenu",function(a,b){q.editor.ui.Popup.postHide(b)});b.addListener("keydown",function(a,b){d&&d.dispose(b);var c=b.keyCode||b.which;if(b.altKey&&90==c)UE.ui.buttons.fullscreen.onclick()});b.addListener("wordcount",
function(){a(this,c)});b.addListener("selectionchange",function(){if(b.options.elementPathEnabled)c[(-1==b.queryCommandState("elementpath")?"dis":"en")+"ableElementPath"]();if(b.options.scaleEnabled)c[(-1==b.queryCommandState("scale")?"dis":"en")+"ableScale"]()});var h=new q.editor.ui.Popup({editor:b,content:"",className:"edui-bubble",_onEditButtonClick:function(){this.hide();b.ui._dialogs.linkDialog.open()},_onImgEditButtonClick:function(a){this.hide();b.ui._dialogs[a]&&b.ui._dialogs[a].open()},
_onImgSetFloat:function(a){this.hide();b.execCommand("imagefloat",a)},_setIframeAlign:function(a){var b=h.anchorEl,c=b.cloneNode(!0);switch(a){case -2:c.setAttribute("align","");break;case -1:c.setAttribute("align","left");break;case 1:c.setAttribute("align","right")}b.parentNode.insertBefore(c,b);H.remove(b);h.anchorEl=c;h.showAnchor(h.anchorEl)},_updateIframe:function(){b._iframe=h.anchorEl;b.ui._dialogs.insertframeDialog.open();h.hide()},_onRemoveButtonClick:function(a){b.execCommand(a);this.hide()},
queryAutoHide:function(a){return a&&a.ownerDocument==b.document&&("img"==a.tagName.toLowerCase()||H.findParentByTagName(a,"a",!0))?a!==h.anchorEl:q.editor.ui.Popup.prototype.queryAutoHide.call(this,a)}});h.render();b.options.imagePopup&&(b.addListener("mouseover",function(a,c){c=c||window.event;var d=c.target||c.srcElement;if(b.ui._dialogs.insertframeDialog&&/iframe/ig.test(d.tagName)){var e=h.formatHtml("<nobr>"+b.getLang("property")+': <span onclick=$$._setIframeAlign(-2) class="edui-clickable">'+
b.getLang("default")+'</span>&nbsp;&nbsp;<span onclick=$$._setIframeAlign(-1) class="edui-clickable">'+b.getLang("justifyleft")+'</span>&nbsp;&nbsp;<span onclick=$$._setIframeAlign(1) class="edui-clickable">'+b.getLang("justifyright")+'</span>&nbsp;&nbsp; <span onclick="$$._updateIframe( this);" class="edui-clickable">'+b.getLang("modify")+"</span></nobr>");e?(h.getDom("content").innerHTML=e,h.anchorEl=d,h.showAnchor(h.anchorEl)):h.hide()}}),b.addListener("selectionchange",function(a,c){if(c){var d=
"",e="",f=b.selection.getRange().getClosedNode(),e=b.ui._dialogs;if(f&&"IMG"==f.tagName){var g="insertimageDialog";-1!=f.className.indexOf("edui-faked-video")&&(g="insertvideoDialog");-1!=f.className.indexOf("edui-faked-webapp")&&(g="webappDialog");-1!=f.src.indexOf("http://api.map.baidu.com")&&(g="mapDialog");-1!=f.className.indexOf("edui-faked-music")&&(g="musicDialog");-1!=f.src.indexOf("http://maps.google.com/maps/api/staticmap")&&(g="gmapDialog");f.getAttribute("anchorname")&&(g="anchorDialog",
d=h.formatHtml("<nobr>"+b.getLang("property")+': <span onclick=$$._onImgEditButtonClick("anchorDialog") class="edui-clickable">'+b.getLang("modify")+"</span>&nbsp;&nbsp;<span onclick=$$._onRemoveButtonClick('anchor') class=\"edui-clickable\">"+b.getLang("delete")+"</span></nobr>"));f.getAttribute("word_img")&&(b.word_img=[f.getAttribute("word_img")],g="wordimageDialog");if(!e[g])return;e="<nobr>"+b.getLang("property")+': <span onclick=$$._onImgSetFloat("none") class="edui-clickable">'+b.getLang("default")+
'</span>&nbsp;&nbsp;<span onclick=$$._onImgSetFloat("left") class="edui-clickable">'+b.getLang("justifyleft")+'</span>&nbsp;&nbsp;<span onclick=$$._onImgSetFloat("right") class="edui-clickable">'+b.getLang("justifyright")+'</span>&nbsp;&nbsp;<span onclick=$$._onImgSetFloat("center") class="edui-clickable">'+b.getLang("justifycenter")+"</span>&nbsp;&nbsp;<span onclick=\"$$._onImgEditButtonClick('"+g+'\');" class="edui-clickable">'+b.getLang("modify")+"</span></nobr>";!d&&(d=h.formatHtml(e))}if(b.ui._dialogs.linkDialog){var n=
b.queryCommandValue("link"),p;if(n&&(p=n.getAttribute("_href")||n.getAttribute("href",2)))e=p,30<p.length&&(e=p.substring(0,20)+"..."),d&&(d+='<div style="height:5px;"></div>'),d+=h.formatHtml("<nobr>"+b.getLang("anthorMsg")+': <a target="_blank" href="'+p+'" title="'+p+'" >'+e+'</a> <span class="edui-clickable" onclick="$$._onEditButtonClick();">'+b.getLang("modify")+'</span> <span class="edui-clickable" onclick="$$._onRemoveButtonClick(\'unlink\');"> '+b.getLang("clear")+"</span></nobr>"),h.showAnchor(n)}d?
(h.getDom("content").innerHTML=d,h.anchorEl=f||n,h.showAnchor(h.anchorEl)):h.hide()}}))},_initToolbars:function(){for(var a=this.editor,b=this.toolbars||[],c=[],d=0;d<b.length;d++){for(var e=b[d],f=new q.editor.ui.Toolbar({theme:a.options.theme}),h=0;h<e.length;h++){var j=e[h],l=null;if("string"==typeof j){if(j=j.toLowerCase(),"|"==j&&(j="Separator"),q.editor.ui[j]&&(l=new q.editor.ui[j](a)),"fullscreen"==j){c&&c[0]?c[0].items.splice(0,0,l):l&&f.items.splice(0,0,l);continue}}else l=j;l&&l.id&&f.add(l)}c[d]=
f}this.toolbars=c},getHtmlTpl:function(){return'<div id="##" class="%%"><div id="##_toolbarbox" class="%%-toolbarbox">'+(this.toolbars.length?'<div id="##_toolbarboxouter" class="%%-toolbarboxouter"><div class="%%-toolbarboxinner">'+this.renderToolbarBoxHtml()+"</div></div>":"")+'<div id="##_toolbarmsg" class="%%-toolbarmsg" style="display:none;"><div id = "##_upload_dialog" class="%%-toolbarmsg-upload" onclick="$$.showWordImageDialog();">'+this.editor.getLang("clickToUpload")+'</div><div class="%%-toolbarmsg-close" onclick="$$.hideToolbarMsg();">x</div><div id="##_toolbarmsg_label" class="%%-toolbarmsg-label"></div><div style="height:0;overflow:hidden;clear:both;"></div></div></div><div id="##_iframeholder" class="%%-iframeholder"></div><div id="##_bottombar" class="%%-bottomContainer"><table><tr><td id="##_elementpath" class="%%-bottombar"></td><td id="##_wordcount" class="%%-wordcount"></td><td id="##_scale" class="%%-scale"><div class="%%-icon"></div></td></tr></table></div><div id="##_scalelayer"></div></div>'},
showWordImageDialog:function(){this.editor.execCommand("wordimage","word_img");this._dialogs.wordimageDialog.open()},renderToolbarBoxHtml:function(){for(var a=[],b=0;b<this.toolbars.length;b++)a.push(this.toolbars[b].renderHtml());return a.join("")},setFullScreen:function(a){var b=this.editor,c=b.container.parentNode.parentNode;if(this._fullscreen!=a){this._fullscreen=a;this.editor.fireEvent("beforefullscreenchange",a);if(q.editor.browser.gecko)var d=b.selection.getRange().createBookmark();if(a){for(;"BODY"!=
c.tagName;){var e=q.editor.dom.domUtils.getComputedStyle(c,"position");zc.push(e);c.style.position="static";c=c.parentNode}this._bakHtmlOverflow=document.documentElement.style.overflow;this._bakBodyOverflow=document.body.style.overflow;this._bakAutoHeight=this.editor.autoHeightEnabled;this._bakScrollTop=Math.max(document.documentElement.scrollTop,document.body.scrollTop);this._bakEditorContaninerWidth=b.iframe.parentNode.offsetWidth;this._bakAutoHeight&&(b.autoHeightEnabled=!1,this.editor.disableAutoHeight());
document.documentElement.style.overflow="hidden";document.body.style.overflow="hidden";this._bakCssText=this.getDom().style.cssText;this._bakCssText1=this.getDom("iframeholder").style.cssText;b.iframe.parentNode.style.width="";this._updateFullScreen()}else{for(;"BODY"!=c.tagName;)c.style.position=zc.shift(),c=c.parentNode;this.getDom().style.cssText=this._bakCssText;this.getDom("iframeholder").style.cssText=this._bakCssText1;this._bakAutoHeight&&(b.autoHeightEnabled=!0,this.editor.enableAutoHeight());
document.documentElement.style.overflow=this._bakHtmlOverflow;document.body.style.overflow=this._bakBodyOverflow;b.iframe.parentNode.style.width=this._bakEditorContaninerWidth+"px";window.scrollTo(0,this._bakScrollTop)}if(q.editor.browser.gecko&&"true"===b.body.contentEditable){var f=document.createElement("input");document.body.appendChild(f);b.body.contentEditable=!1;setTimeout(function(){f.focus();setTimeout(function(){b.body.contentEditable=!0;b.selection.getRange().moveToBookmark(d).select(!0);
q.editor.dom.domUtils.remove(f);a&&window.scroll(0,0)},0)},0)}"true"===b.body.contentEditable&&(this.editor.fireEvent("fullscreenchanged",a),this.triggerLayout())}},_updateFullScreen:function(){if(this._fullscreen){var a=yc.getViewportRect();this.getDom().style.cssText="border:0;position:absolute;left:0;top:"+(this.editor.options.topOffset||0)+"px;width:"+a.width+"px;height:"+a.height+"px;z-index:"+(1*this.getDom().style.zIndex+100);yc.setViewportOffset(this.getDom(),{left:0,top:this.editor.options.topOffset||
0});this.editor.setHeight(a.height-this.getDom("toolbarbox").offsetHeight-this.getDom("bottombar").offsetHeight-(this.editor.options.topOffset||0));if(n.gecko)window.onresize()}},_updateElementPath:function(){var a=this.getDom("elementpath"),b;if(this.elementPathEnabled&&(b=this.editor.queryCommandValue("elementpath"))){for(var c=[],d=0,e;e=b[d];d++)c[d]=this.formatHtml('<span unselectable="on" onclick="$$.editor.execCommand(&quot;elementpath&quot;, &quot;'+d+'&quot;);">'+e+"</span>");a.innerHTML=
'<div class="edui-editor-breadcrumb" onmousedown="return false;">'+this.editor.getLang("elementPathTip")+": "+c.join(" &gt; ")+"</div>"}else a.style.display="none"},disableElementPath:function(){var a=this.getDom("elementpath");a.innerHTML="";a.style.display="none";this.elementPathEnabled=!1},enableElementPath:function(){this.getDom("elementpath").style.display="";this.elementPathEnabled=!0;this._updateElementPath()},_scale:function(){function a(){t=H.getXY(h);s||(s=f.options.minFrameHeight+l.offsetHeight+
k.offsetHeight);p.style.cssText="position:absolute;left:0;display:;top:0;background-color:#41ABFF;opacity:0.4;filter: Alpha(opacity=40);width:"+h.offsetWidth+"px;height:"+h.offsetHeight+"px;z-index:"+(f.options.zIndex+1);H.on(e,"mousemove",b);H.on(j,"mouseup",c);H.on(e,"mouseup",c)}function b(a){d();a=a||window.event;w=a.pageX||e.documentElement.scrollLeft+a.clientX;x=a.pageY||e.documentElement.scrollTop+a.clientY;y=w-t.x;r=x-t.y;y>=u&&(q=!0,p.style.width=y+"px");r>=s&&(q=!0,p.style.height=r+"px")}
function c(){q&&(q=!1,f.ui._actualFrameWidth=p.offsetWidth-2,h.style.width=f.ui._actualFrameWidth+"px",f.setHeight(p.offsetHeight-k.offsetHeight-l.offsetHeight-2));p&&(p.style.display="none");d();H.un(e,"mousemove",b);H.un(j,"mouseup",c);H.un(e,"mouseup",c)}function d(){n.ie?e.selection.clear():window.getSelection().removeAllRanges()}var e=document,f=this.editor,h=f.container,j=f.document,l=this.getDom("toolbarbox"),k=this.getDom("bottombar"),m=this.getDom("scale"),p=this.getDom("scalelayer"),q=!1,
t=null,s=0,u=f.options.minFrameWidth,w=0,x=0,y=0,r=0,B=this;this.editor.addListener("fullscreenchanged",function(a,b){if(b)B.disableScale();else if(B.editor.options.scaleEnabled){B.enableScale();var c=B.editor.document.createElement("span");B.editor.body.appendChild(c);B.editor.body.style.height=Math.max(H.getXY(c).y,B.editor.iframe.offsetHeight-20)+"px";H.remove(c)}});this.enableScale=function(){1!=f.queryCommandState("source")&&(m.style.display="",this.scaleEnabled=!0,H.on(m,"mousedown",a))};this.disableScale=
function(){m.style.display="none";this.scaleEnabled=!1;H.un(m,"mousedown",a)}},isFullScreen:function(){return this._fullscreen},postRender:function(){Pd.prototype.postRender.call(this);for(var a=0;a<this.toolbars.length;a++)this.toolbars[a].postRender();var b=this,c,d=q.editor.dom.domUtils,e=function(){clearTimeout(c);c=setTimeout(function(){b._updateFullScreen()})};d.on(window,"resize",e);b.addListener("destroy",function(){d.un(window,"resize",e);clearTimeout(c)})},showToolbarMsg:function(a,b){this.getDom("toolbarmsg_label").innerHTML=
a;this.getDom("toolbarmsg").style.display="";b||(this.getDom("upload_dialog").style.display="none")},hideToolbarMsg:function(){this.getDom("toolbarmsg").style.display="none"},mapUrl:function(a){return a?a.replace("~/",this.editor.options.UEDITOR_HOME_URL||""):""},triggerLayout:function(){var a=this.getDom();a.style.zoom="1"==a.style.zoom?"100%":"1"}};cb.inherits(bb,q.editor.ui.UIBase);var na={};UE.ui.Editor=function(a){var b=new q.editor.Editor(a);b.options.editor=b;cb.loadFile(document,{href:b.options.themePath+
b.options.theme+"/css/ueditor.css",tag:"link",type:"text/css",rel:"stylesheet"});var c=b.render;b.render=function(a){a.constructor===String&&(b.key=a,na[a]=b);cb.domReady(function(){function e(){b.setOpt({labelMap:b.options.labelMap||b.getLang("labelMap")});new bb(b.options);if(a&&(a.constructor===String&&(a=document.getElementById(a)),a&&a.getAttribute("name")&&(b.options.textarea=a.getAttribute("name")),a&&/script|textarea/ig.test(a.tagName))){var e=document.createElement("div");a.parentNode.insertBefore(e,
a);var f=a.value||a.innerHTML;b.options.initialContent=/^[\t\r\n ]*$/.test(f)?b.options.initialContent:f.replace(/>[\n\r\t]+([ ]{4})+/g,">").replace(/[\n\r\t]+([ ]{4})+</g,"<").replace(/>[\n\r\t]+</g,"><");a.className&&(e.className=a.className);a.style.cssText&&(e.style.cssText=a.style.cssText);/textarea/i.test(a.tagName)?(b.textarea=a,b.textarea.style.display="none"):(a.parentNode.removeChild(a),a.id&&(e.id=a.id));a=e;a.innerHTML=""}H.addClass(a,"edui-"+b.options.theme);b.ui.render(a);e=b.options;
b.container=b.ui.getDom();for(var f=H.findParents(a,!0),j=[],l=0,k;k=f[l];l++)j[l]=k.style.display,k.style.display="block";e.minFrameWidth=e.initialFrameWidth?e.initialFrameWidth:e.initialFrameWidth=a.offsetWidth;e.initialFrameHeight?e.minFrameHeight=e.initialFrameHeight:e.initialFrameHeight=e.minFrameHeight=a.offsetHeight;for(l=0;k=f[l];l++)k.style.display=j[l];a.style.height&&(a.style.height="");b.container.style.width=e.initialFrameWidth+"px";b.container.style.zIndex=e.zIndex;c.call(b,b.ui.getDom("iframeholder"))}
b.langIsReady?e():b.addListener("langReady",e)})};return b};UE.getEditor=function(a,b){var c=na[a];c||(c=na[a]=new UE.ui.Editor(b),c.render(a));return c};UE.delEditor=function(a){var b;if(b=na[a])b.key&&b.destroy(),delete na[a]};var Qd=q.editor.utils,Rd=q.editor.ui.Popup,Sd=q.editor.ui.SplitButton,Ac=q.editor.ui.MultiMenuPop=function(a){this.initOptions(a);this.initMultiMenu()};Ac.prototype={initMultiMenu:function(){var a=this;this.popup=new Rd({content:"",editor:a.editor,iframe_rendered:!1,onshow:function(){this.iframe_rendered||
(this.iframe_rendered=!0,this.getDom("content").innerHTML='<iframe id="'+a.id+'_iframe" src="'+a.iframeUrl+'" frameborder="0"></iframe>',a.editor.container.style.zIndex&&(this.getDom().style.zIndex=1*a.editor.container.style.zIndex+1))}});this.onbuttonclick=function(){this.showPopup()};this.initSplitButton()}};Qd.inherits(Ac,Sd)})();
